Posted by gerg on 06/11/83 11:37
David Dorward wrote:
> tea-mad brit wrote:
>
>
>>I don't know anything about JS but a little PHP. If I understand
>>correctly, I need to modify the server side script and that the required
>>stuff in the input form isn't doing anything?
>
>
> The required stuff in the input form is providing data that gets sent to the
> server. The server side script could use this to decide what to test for in
> its sanity checking routines.
>
use something like this:
processor.php
<?
session_start();
// the $_POST variables should be the same as your form names.
if( (empty($_POST['email'])) || (empty($_POST['name'])) ||
(empty($_POST['phone'])) ){
// return to the form and display an error message.
$_SESSION['errormessage']="Please fill out all form fields.";
header("Location:http://www.mysite.com/myform.php");
exit();
}
else
{
// execute code that should happen if all fields are filled in.
}
?>
myform.php
<?
//this line makes available any session variables already set, like the
error message above.
session_start();
//if there is an error message available, display it
if($_SESSION['errormessage']){
echo $_SESSION['errormessage'];
}
?>
Your form would then go here.
Hope that helps.
Greg
Navigation:
[Reply to this message]
|