PDA

View Full Version : Required Fields



matrixxxxxx1
04-29-2006, 03:41 AM
Hi
Is Naval Design around plzzzzz or any other expert

I have my form up and running, but would like to add required fields to name and email. this is my contact link. http://www.atexflooring.ca/contact.html
I went over some of the threads here on the subject, however I kept runing into errors.

this is the script I have in there as of now.
I appreciate any help you guys can offer

Thnx

mike

<?PHP
$email = $HTTP_POST_VARS[email];
$mailto = "me@mydomain.ca";
$mailsubj = "Inquiry form Contact Us";
$mailhead = "From: $email\n";
reset ($HTTP_POST_VARS);
$mailbody = "Customer Inquiry from Contact Us page:\n";
while (list ($key, $val) = each ($HTTP_POST_VARS))
{
$mailbody .= "$key : $val\n";
}
mail($mailto, $mailsubj, $mailbody, $mailhead);
?>

Girlonthehill
04-29-2006, 03:44 AM
Hi
Is Naval Design around plzzzzz or any other expert

I have my form up and running, but would like to add required fields to name and email. this is my contact link. http://www.atexflooring.ca/contact.html
I went over some of the threads here on the subject, however I kept runing into errors.

this is the script I have in there as of now.
I appreciate any help you guys can offer

Thnx

mike

<?PHP
$email = $HTTP_POST_VARS[email];
$mailto = "me@mydomain.ca";
$mailsubj = "Inquiry form Contact Us";
$mailhead = "From: $email\n";
reset ($HTTP_POST_VARS);
$mailbody = "Customer Inquiry from Contact Us page:\n";
while (list ($key, $val) = each ($HTTP_POST_VARS))
{
$mailbody .= "$key : $val\n";
}
mail($mailto, $mailsubj, $mailbody, $mailhead);
?>
I couldn't see your email on your site, but if you let me know it, I'll send you one of mine, that Naval did for me. You can then check line for line what you need. Would that help?

matrixxxxxx1
04-29-2006, 03:47 AM
Thnx Amanda

mike@atexflooring.ca


mike

Girlonthehill
04-29-2006, 03:50 AM
Thnx Amanda

mike@atexflooring.ca


mike
On it's way, Mike.

matrixxxxxx1
04-29-2006, 03:54 AM
On it's way, Mike.

Thnx Amanda

I'll have a look, hopefully I can figure it out.

mike

Girlonthehill
04-29-2006, 03:56 AM
Thnx Amanda

I'll have a look, hopefully I can figure it out.

mike
Any time, hope it helps.

matrixxxxxx1
04-29-2006, 03:59 AM
This is like trying to learn chinese for the first time....lol

Thnx Amanda, but I don't quite get it from your file. It's loaded with commands.

Thnx anyways

Mike

Girlonthehill
04-29-2006, 04:03 AM
This is like trying to learn chinese for the first time....lol

Thnx Amanda, but I don't quite get it from your file. It's loaded with commands.

Thnx anyways

Mike
Yeah, it's a big form but the validation is only on the email addresses and contact (I think), thought maybe you could work it out. If not Naval or another expert will be along shortly. Hang on in there...

matrixxxxxx1
04-29-2006, 04:28 AM
I made email error page and name error page with this script from naval from another thread, but no luck


<?PHP

@$email = addslashes($_POST['email']);
@$name = addslashes($_POST['name']);

// Validation for empty fields
if (strlen($email) == 0 )
{
header("Location: http://www.atexflooring.ca/email_errorpage.html");
exit;
}
if (strlen($name) == 0 )
{
header("Location: http://www.atexflooring.ca/name_errorpage.html");
exit;
}

$mailto = "mike@atexflooring.ca";
$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);
?>



I keep getting this error:

Warning: Cannot modify header information - headers already sent by (output started at /home/xxxxx/public_html/feedback.php:7) in /home/xxxxxx/public_html/feedback.php on line 105


Helpppppppp


mike

Girlonthehill
04-29-2006, 04:39 AM
I made email error page and name error page with this script from naval from another thread, but no luck


<?PHP

@$email = addslashes($_POST['email']);
@$name = addslashes($_POST['name']);

// Validation for empty fields
if (strlen($email) == 0 )
{
header("Location: http://www.atexflooring.ca/email_errorpage.html");
exit;
}
if (strlen($name) == 0 )
{
header("Location: http://www.atexflooring.ca/name_errorpage.html");
exit;
}

$mailto = "mike@atexflooring.ca";
$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);
?>



I keep getting this error:

Warning: Cannot modify header information - headers already sent by (output started at /home/xxxxx/public_html/feedback.php:7) in /home/xxxxxx/public_html/feedback.php on line 105


Helpppppppp


mike
YIKES!!! I'm not that good at it either. I tried doing it myself a couple of weeks ago and messed it up royal. I think I should leave now and forget I ever helped you. Lol! You need expert help. Naval or someone else who understands it will be along soon - hold on in there. Sorry!

matrixxxxxx1
04-29-2006, 04:55 AM
Thnx for trying Amanda. I Aprecaite your effort.

Mike

matrixxxxxx1
04-29-2006, 04:14 PM
Where are all the experts???


Mike

davidundalicia
04-29-2006, 06:07 PM
mike,
Its a jungle.......
.
here is the simplest one that actually works.......
1 contact.bvp form
1 contact.php file (ftp to main directory)
3 error type .bvp forms.
1 confirm.bvp form
.
<?PHP
@$name = addslashes($_POST['name']);
@$email = addslashes($_POST['email']);
@$comments = addslashes($_POST['comments']);
if (strlen($name) == 0 )
{
header("Location: nameerror.html");
exit;
}
if (strlen($email) == 0 )
{
header("Location: emailerror.html");
exit;
}
if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $email))
{
header("Location: emailerror.html");
exit;
}
if (strlen($comments) == 0 )
{
header("Location: http://mvpalma1.com/sales/commenterror.html");
exit;
}
$mailto = "admin@mvtinia.com"; change this to your email
$mailsubj = "Feedback from mvpalma1 form";
$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://mvpalma1.com/confirm.html");
?>

see them working at either of my 2 sites below...

Any probs, post again or you can email me....

matrixxxxxx1
04-29-2006, 08:34 PM
mike,
Its a jungle.......
.
here is the simplest one that actually works.......
1 contact.bvp form
1 contact.php file (ftp to main directory)
3 error type .bvp forms.
1 confirm.bvp form
.
<?PHP
@$name = addslashes($_POST['name']);
@$email = addslashes($_POST['email']);
@$comments = addslashes($_POST['comments']);
if (strlen($name) == 0 )
{
header("Location: nameerror.html");
exit;
}
if (strlen($email) == 0 )
{
header("Location: emailerror.html");
exit;
}
if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $email))
{
header("Location: emailerror.html");
exit;
}
if (strlen($comments) == 0 )
{
header("Location: http://mvpalma1.com/sales/commenterror.html");
exit;
}
$mailto = "admin@mvtinia.com"; change this to your email
$mailsubj = "Feedback from mvpalma1 form";
$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://mvpalma1.com/confirm.html");
?>

see them working at either of my 2 sites below...

Any probs, post again or you can email me....


Thnx alot David, I appreciate your help
I did as you mentioned and it seemed to work right away, then i'm not sure what i did, but the problem I'm having now is it keeps redircting me to http://www.atexflooring.ca/www.atexflooring.ca/nameerror.html
http://www.atexflooring.ca/www.atexflooring.ca/emailerror.html
I can't get it to just go to www.atexflooring.ca/nameerror.html or www.atexflooring.ca/emailerror.html
it keeps going twice www.mydomain/error/www.mydomain/error
I checked the script over and over. I have no idea why it's doing that
The confirmation page is working but not the error pages due to links.

I just wanted to do name and email for required fields...Can you check this for errors plz

<?PHP
@$name = addslashes($_POST['name']);
@$email = addslashes($_POST['email']);
if (strlen($name) == 0 )
{
header("Location: www.atexflooring.ca/nameerror.html");
exit;
}
if (strlen($email) == 0 )
{
header("Location: www.atexflooring.ca/emailerror.html");
exit;
}
if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $email))
{
header("Location: www.atexflooring.ca/emailerror.html");
exit;
}
$mailto = "mike@atexflooring.ca";
$mailsubj = "Feedback from atex flooring form";
$mailhead = "From: $email\n";
reset ($HTTP_POST_VARS);
$mailbody = "Customer inquiry from contact us:\n";
while (list ($key, $val) = each ($HTTP_POST_VARS))
{
$mailbody .= "$key : $val\n";
}
mail($mailto, $mailsubj, $mailbody, $mailhead);
header("Location: http://atexflooring.ca/confirm.html");
?>




mike

matrixxxxxx1
04-29-2006, 08:43 PM
Finally It's working http://www.vodahost.com/vodatalk/images/icons/icon7.gif

David you're my herohttp://www.vodahost.com/vodatalk/images/icons/icon7.gif
Thnx a bunch. I appreciate all your help.


Mike

davidundalicia
04-29-2006, 09:00 PM
Mike,
Just went to your site and tested both fields with and without values
and both are working FINE.......
Did you get my two emails ???

btw: the back buttons are fine on your error pages
but I dont think its required on your confirmation page as you have your
menu buttons available.......

enjoy

davidundalicia
04-29-2006, 09:02 PM
we must have crossed in the writing......

Alls well that end well

enjoy

matrixxxxxx1
04-29-2006, 09:15 PM
Mike,
Just went to your site and tested both fields with and without values
and both are working FINE.......
Did you get my two emails ???

btw: the back buttons are fine on your error pages
but I dont think its required on your confirmation page as you have your
menu buttons available.......

enjoy

Thnx David

The confirmation page, I wanted that page to appear for few seconds and go back on its own to the previous page without the visitor having to click back or anything, but I'll settle for this.

I got your emails. Thnx for testing out the form.

Mike