View Single Post
  #5 (permalink)  
Old 11-13-2008, 05:08 AM
fulleffect's Avatar
fulleffect fulleffect is offline
WebProWorld Pro
 
Join Date: Jun 2008
Location: Northeast UK
Posts: 106
fulleffect RepRank 1
Default Re: PHP Sticky fields

I usually just do something like this........


Code:
<?

//check the submit button has been pressed
if($_POST)
{

//check fields arent blank
if($_POST['name']!="" &&
$_POST['telephone']!="")
{

//do further validation and upon success, mail
etc etc
mail();
unset($_POST);
$msg = 'Thank you, your details have been submitted';

}
else
{
$msg = 'Please ensure fields arent blank';
}


}
?>

<html>

<?=$msg?>

<form method="post" action="<?=$_SERVER['REQUEST_URI'];?>">

<input type="text" name="name" id="name" value="<?=$_POST['name']?>" /><br />
<input type="text" name="telephone" id="telephone" value="<?=$_POST['telephone']?>" /><br />
<input type="submit" name="submit" value="Submit" />

</form>

</html>
__________________

Reply With Quote