You are here: Re: Form Require Hidden Input Not Working « HTML « IT news, forums, messages
Re: Form Require Hidden Input Not Working

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация