How do i set a field on a form to ''information required'' and if it is set to this, the user MUST input info or the form will reset or tell him he didnt enter info?
Information Required Field
Collapse
X
-
Information Required Field
Tags: None
-
-
Re: Information Required Field
ou need a script that will check for empty fields and then, if it finds one, redirects the visitor to an error page. Look at: http://www.vodahost.com/vodatalk/for...html#post26480Navaldesign
Logger Lite: Low Cost, Customizable, multifeatured Login script
Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!
-
-
Re: Information Required Field
Thanks for that but the link you have given has just confused me even more. I know exactly what is needed but cant get it from your convo with bird.
I already am using a script the you provided a while back, which emails me the form and directs the submitter to a thankyou page.
Can i just add the information required script lines to this script i am already using?
If so, could you show me the lines that are needed?
The 2 boxes i need info required for are named ''full name'' and ''email address''.
Any help would be greatly appreciated as i am stuck stuck stuck.
Comment
-
-
Re: Information Required Field
I don't know (or remember) which script you have adopted. Post it here and i'll tell you if you can just add lines, or you need to schange it completely.Navaldesign
Logger Lite: Low Cost, Customizable, multifeatured Login script
Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!
Comment
-
-
Re: Information Required Field
<?PHP
$email = $HTTP_POST_VARS[email];
$mailto = "my email address";
$mailsubj = "Contact Us";
$mailhead = "From: $email\n";
reset ($HTTP_POST_VARS);
$mailbody = "Values submitted from web site form:\n";
while (list ($key, $val) = each ($HTTP_POST_VARS))
{
$mailbody .= "$key : $val\n";
}
mail($mailto, $mailsubj, $mailbody, $mailhead);
header("Location: http://www.e-advertz.com/thank_you.html");
?>
this is the script i currently use and adjust for my different forms. On this particular form there are two fields out of four that i wish to be 'info required'', one is a name and one is email address.
Comment
-
-
Re: Information Required Field
<?PHP
@$email = addslashes($_POST['email']);
@$name = addslashes($_POST['name']);
// Validation for empty fields
if (strlen($email) == 0 )
{
header("Location: http://www.e-advertz.com/email_errorpage.html");
exit;
}
if (strlen($name) == 0 )
{
header("Location: http://www.e-advertz.com/name_errorpage.html");
exit;
}
$mailto = "my email address"; //Put your real Vodahost email address here
$mailsubj = "Contact Us";
$mailhead = "From: $email\n";
reset ($HTTP_POST_VARS);
$mailbody = "Values submitted from web site form:\n";
while (list ($key, $val) = each ($HTTP_POST_VARS))
{
$mailbody .= "$key : $val\n";
}
mail($mailto, $mailsubj, $mailbody, $mailhead);
header("Location: http://www.e-advertz.com/thank_you.html");
?>
Create two error pages: email_errorpage.html and name_errorpage.html one for empty email field, and one for empty name field. Of course you can only make one if youwish, but change the script accordingly.
The two required fields are supposed to be called "email" and "name".Navaldesign
Logger Lite: Low Cost, Customizable, multifeatured Login script
Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!
Comment
-
-
Re: Information Required Field
mate, yet again your a star, works a treat and more importantly, it all makes sense for the future.
just one little picky thing, IF i was to have 2 error pages and BOTH fields were left empty, which page would the php file default to?
Comment
-
-
Re: Information Required Field
It would first find the email, then the name, as their order is in the script. The blocks are:
if (strlen($email) == 0 )
{
header("Location: http://www.e-advertz.com/email_errorpage.html");
exit;
}
and
if (strlen($name) == 0 )
{
header("Location: http://www.e-advertz.com/name_errorpage.html");
exit;
}
If you want them viceversa, just invert the blocksNavaldesign
Logger Lite: Low Cost, Customizable, multifeatured Login script
Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!
Comment
-
-
Re: Information Required Field
And i think Andy128 can take from here the necessary material to create another tutorial, on validating form fields.Navaldesign
Logger Lite: Low Cost, Customizable, multifeatured Login script
Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!
Comment
-
Comment