jonleow
-
Posts
2 -
Joined
-
Last visited
Never
Posts posted by jonleow
-
-
Hi, i have a php file which validate missing input in a form. The code is as follows:
--------------------------------------------------------------------------------------------
<?php
$submit = (mysql_escape_string($_POST['submit']) == "Submit Now") ? true : false;
$firstName = mysql_escape_string($_POST['firstName']);
$middleName = mysql_escape_string($_POST['middleName']);
$lastName = mysql_escape_string($_POST['lastName']);
if ($submit) {
if ($firstName == "") {
echo "Please enter your firstName";
}
elseif ($middleName =="") {
echo "PLease enter your middleName";
}
elseif ($lastName == "") {
echo "Please neter your lastName";
}
exit();
}
?>
else {
echo "Welcome $firstName $lastName";
}
--------------------------------------------------------------------------------------------
What I wanna do is that i want to provide a link back to my form and i do not want those fields the users have typed in to be empty. What the users keyed in remain and i want the users continue keying the fields they accidentally left out.
question regarding form
in PHP Coding Help
Posted