contact form

Reply

Join Date: Feb 2009
Posts: 58
Reputation: rohnni is an unknown quantity at this point 
Solved Threads: 0
rohnni rohnni is offline Offline
Junior Poster in Training

contact form

 
0
  #1
Feb 27th, 2009
  1. <?php
  2.  
  3. define("ContactEmail", "highwebgeeta@gmail.com");
  4. $error_msg = 'The following fields were left empty or contain invalid information:<ul>';
  5. $error = false;
  6.  
  7. $submit = $_POST['submit'];
  8. if (empty($submit))
  9. $form_submitted = false;
  10. else
  11. $form_submitted = true;
  12.  
  13. if ($form_submitted) {
  14. $title = $_POST['title'];
  15. $name = $_POST['name'];
  16. $lname = $_POST['lname'];
  17. $address = $_POST['address'];
  18. $pin = $_POST['pin'];
  19. $country = $_POST['country'];
  20. $contact = $_POST['contact'];
  21. $email = $_POST['email'];
  22.  
  23. if(!$name) { $error_msg .= "<li>Full Name</li>"; $error = true; }
  24. if(!$email) { $error_msg .= "<li>E-mail Address</li>"; $error = true; }
  25. if(!$contact) { $error_msg .= "<li>contact</li>"; $error = true; }
  26. if($email) { if(!eregi("^[a-z0-9_]+@[a-z0-9\-]+\.[a-z0-9\-\.]+$", $email)){ $error_msg .= "<li>E-mail Address</li>"; $error = true; }}
  27. $error_msg .= "</ul>";
  28.  
  29. if (!$error) {
  30.  
  31. $msg = "Full Name: \t $name \n";
  32. $msg .= "Contact: \t $contact \n";
  33. $msg .= "E-mail Address: \t $email \n";
  34. $msg .= "address: \n---\n $address \n---\n";
  35.  
  36. $mailheaders = "Enquiry";
  37. $mailheaders .= "Content-type: text/plain; charset=iso-8859-1\r\n";
  38. $mailheaders .= "From: $name <$email>\r\n";
  39. $mailheaders .= "Reply-To: $name <$email>\r\n";
  40.  
  41. mail(ContactEmail, $subject , stripslashes($msg), $mailheaders);
  42. }
  43. }
  44. ?>
  45.  
  46. <?php
  47. // email was successfully send
  48. if (($form_submitted) && (!$error)) {
  49. ?>
  50. <!-- display submitted data -->
  51. Thank you for your feedback, <?php echo $name; ?>.
  52. This is the information you submitted:<br><br><?php echo nl2br(stripslashes($msg)); ?>


i create a contact form that link to 5 pages , please help me to create a contact form using php..
Last edited by peter_budo; Feb 27th, 2009 at 10:16 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,480
Reputation: cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about 
Solved Threads: 136
cwarn23's Avatar
cwarn23 cwarn23 is offline Offline
Nearly a Posting Virtuoso

Re: contact form

 
0
  #2
Feb 27th, 2009
Originally Posted by rohnni
i create a contact form that link to 5 pages , please help me to create a contact form using php..
Well what seems to be the problem. Does it not function properly or are the errors reported. If so, what are the errors reported.
Also I noticed your mail function is incorrect and needs to be as follows:
  1. mail("ContactEmail", $subject , stripslashes($msg), $mailheaders);
Try not to bump 10 year old threads as it can be really annoying.
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 58
Reputation: rohnni is an unknown quantity at this point 
Solved Threads: 0
rohnni rohnni is offline Offline
Junior Poster in Training

Re: contact form

 
0
  #3
Feb 27th, 2009
Parse error: syntax error, unexpected $end in E:\domains\h\highweb.co.uk\user\htdocs\geeta\assignments\php\requirements-form\mail.php on line 61
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 58
Reputation: rohnni is an unknown quantity at this point 
Solved Threads: 0
rohnni rohnni is offline Offline
Junior Poster in Training

Re: contact form

 
0
  #4
Feb 27th, 2009
Parse error: syntax error, unexpected $end in E:\domains\h\highweb.co.uk\user\htdocs\geeta\assignments\php\requirements-form\mail.php on line 61


this error occurs...
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 101
Reputation: ingeva is an unknown quantity at this point 
Solved Threads: 9
ingeva ingeva is offline Offline
Junior Poster

Re: contact form

 
0
  #5
Feb 27th, 2009
Originally Posted by rohnni View Post
Parse error: syntax error, unexpected $end in E:\domains\h\highweb.co.uk\user\htdocs\geeta\assignments\php\requirements-form\mail.php on line 61
this error occurs...
Unequal number of left and right braces.
Yes, I'm running Ubuntu. Of course.
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 58
Reputation: rohnni is an unknown quantity at this point 
Solved Threads: 0
rohnni rohnni is offline Offline
Junior Poster in Training

Re: contact form

 
0
  #6
Feb 27th, 2009
  1. <?php
  2.  
  3. define("ContactEmail", "your-email");
  4. $error_msg = 'The following fields were left empty or contain invalid information:<ul>';
  5. $error = false;
  6.  
  7. $submit = $_POST['submit'];
  8. if (empty($submit))
  9. $form_submitted = false;
  10. else
  11. $form_submitted = true;
  12.  
  13. if ($form_submitted) {
  14. $title = $_POST['title'];
  15. $name = $_POST['name'];
  16. $lname = $_POST['lname'];
  17. $address = $_POST['address'];
  18. $pin = $_POST['pin'];
  19. $country = $_POST['country'];
  20. $contact = $_POST['contact'];
  21. $email = $_POST['email'];
  22.  
  23. if(!$name) { $error_msg .= "<li>Full Name</li>"; $error = true; }
  24. if(!$email) { $error_msg .= "<li>E-mail Address</li>"; $error = true; }
  25. if(!$contact) { $error_msg .= "<li>contact</li>"; $error = true; }
  26. if($email) { if(!eregi("^[a-z0-9_]+@[a-z0-9\-]+\.[a-z0-9\-\.]+$", $email)){ $error_msg .= "<li>E-mail Address</li>"; $error = true; }}
  27. $error_msg .= "</ul>";
  28.  
  29. if (!$error) {
  30.  
  31. $msg = "Full Name: \t $name \n";
  32. $msg .= "Contact: \t $contact \n";
  33. $msg .= "E-mail Address: \t $email \n";
  34. $msg .= "address: \n---\n $address \n---\n";
  35.  
  36. $mailheaders = "Enquiry";
  37. $mailheaders .= "Content-type: text/plain; charset=iso-8859-1\r\n";
  38. $mailheaders .= "From: $name <$email>\r\n";
  39. $mailheaders .= "Reply-To: $name <$email>\r\n";
  40.  
  41. mail("your-email", $subject , stripslashes($msg), $mailheaders);
  42. }
  43. ?>
  44.  
  45. <?php
  46. // email was successfully send
  47. if (($form_submitted) && (!$error)) {
  48. ?>
  49. <!-- display submitted data -->
  50. Thank you for your feedback, <?php echo $name; ?>.
  51. This is the information you submitted:<br><br><?php echo nl2br(stripslashes($msg)); ?>
Last edited by peter_budo; Feb 27th, 2009 at 10:16 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 19
Reputation: Swapsry is an unknown quantity at this point 
Solved Threads: 0
Swapsry Swapsry is offline Offline
Newbie Poster

Re: contact form

 
0
  #7
Feb 27th, 2009
Originally Posted by rohnni View Post
Parse error: syntax error, unexpected $end in E:\domains\h\highweb.co.uk\user\htdocs\geeta\assignments\php\requirements-form\mail.php on line 61

Hi ..

you have to close one if condition at last..

}
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,480
Reputation: cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about 
Solved Threads: 136
cwarn23's Avatar
cwarn23 cwarn23 is offline Offline
Nearly a Posting Virtuoso

Re: contact form

 
0
  #8
Feb 27th, 2009
I just checked you script for what line is 61 and your script only goes to line 52. Could you post from lines 50 to 62 so I can see what needs fixing?
Try not to bump 10 year old threads as it can be really annoying.
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 58
Reputation: rohnni is an unknown quantity at this point 
Solved Threads: 0
rohnni rohnni is offline Offline
Junior Poster in Training

Re: contact form

 
0
  #9
Feb 27th, 2009
  1. <?php
  2.  
  3. define("ContactEmail", "highwebgeeta@gmail.com");
  4. $error_msg = 'The following fields were left empty or contain invalid information:<ul>';
  5. $error = false;
  6.  
  7. $submit = $_POST['submit'];
  8. if (empty($submit))
  9. $form_submitted = false;
  10. else
  11. $form_submitted = true;
  12.  
  13. if ($form_submitted) {
  14. $title = $_POST['title'];
  15. $name = $_POST['name'];
  16. $lname = $_POST['lname'];
  17. $address = $_POST['address'];
  18. $pin = $_POST['pin'];
  19. $country = $_POST['country'];
  20. $contact = $_POST['contact'];
  21. $email = $_POST['email'];
  22.  
  23. if(!$name) { $error_msg .= "<li>Full Name</li>"; $error = true; }
  24. if(!$email) { $error_msg .= "<li>E-mail Address</li>"; $error = true; }
  25. if(!$contact) { $error_msg .= "<li>contact</li>"; $error = true; }
  26. if($email) { if(!eregi("^[a-z0-9_]+@[a-z0-9\-]+\.[a-z0-9\-\.]+$", $email)){ $error_msg .= "<li>E-mail Address</li>"; $error = true; }}
  27. $error_msg .= "</ul>";
  28.  
  29. if (!$error) {
  30.  
  31. $msg = "Full Name: \t $name \n";
  32. $msg .= "Contact: \t $contact \n";
  33. $msg .= "E-mail Address: \t $email \n";
  34. $msg .= "address: \n---\n $address \n---\n";
  35.  
  36. $mailheaders = "Enquiry";
  37. $mailheaders .= "Content-type: text/plain; charset=iso-8859-1\r\n";
  38. $mailheaders .= "From: $name <$email>\r\n";
  39. $mailheaders .= "Reply-To: $name <$email>\r\n";
  40.  
  41. mail("highwebgeeta@gmail.com", $subject , stripslashes($msg), $mailheaders);
  42. }
  43. ?>
  44.  
  45. <?php
  46. // email was successfully send
  47. if (($form_submitted) && (!$error)) {
  48. ?>
  49. <!-- display submitted data -->
  50. Thank you for your feedback, <?php echo $name; ?>.
  51. This is the information you submitted:<br><br><?php echo nl2br(stripslashes($msg));
  52. ?>
Last edited by peter_budo; Feb 27th, 2009 at 10:17 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 58
Reputation: rohnni is an unknown quantity at this point 
Solved Threads: 0
rohnni rohnni is offline Offline
Junior Poster in Training

Re: contact form

 
0
  #10
Feb 27th, 2009
Originally Posted by Swapsry View Post
Hi ..

you have to close one if condition at last..

}

i did bt nothing happened.. same error
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC