help with returning values from form action
Posted: Mon Feb 13, 2006 11:52 am
HI!
I have a webpage with a textfield for a username, a subit button and a textfield to display results. I'm am trying to check if a text file exists first with the username the user enters. So if they enter a username joe then i need to check if joe.txt exists in my root dir. Using Apache 2.0. If it does exist i need to return, to the page, "doesnt exist" in the second textfield. I am also trying NOT to naviagte away from the webpage, if not navigate to xxxcom/Fexists.php?
any help would be great!
Html code i'm using is,
Fexists.php.
I have a webpage with a textfield for a username, a subit button and a textfield to display results. I'm am trying to check if a text file exists first with the username the user enters. So if they enter a username joe then i need to check if joe.txt exists in my root dir. Using Apache 2.0. If it does exist i need to return, to the page, "doesnt exist" in the second textfield. I am also trying NOT to naviagte away from the webpage, if not navigate to xxxcom/Fexists.php?
any help would be great!
Html code i'm using is,
Code: Select all
<form method="POST" action="Fexists.php">
<p><input type="text" name="SFile" size="20" value="Your filename here">
<input type="submit" value="Submit" name="B1"></p>
</form>Code: Select all
<?php
$Zref = $_REQUEST['SFile'];
$Zref = $Zref.".txt";
if (file_exists("files/".$Zref)) {
echo "File exists try another";
}
else {
echo "File doesn't exists";
}
?>