943,840 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 1199
  • PHP RSS
You are currently viewing page 1 of this multi-page discussion thread
Feb 27th, 2009
0

contact form

Expand Post »
php Syntax (Toggle Plain Text)
  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.
Similar Threads
Reputation Points: 6
Solved Threads: 0
Junior Poster in Training
rohnni is offline Offline
58 posts
since Feb 2009
Feb 27th, 2009
0

Re: contact form

Quote 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:
php Syntax (Toggle Plain Text)
  1. mail("ContactEmail", $subject , stripslashes($msg), $mailheaders);
Sponsor
Featured Poster
Reputation Points: 410
Solved Threads: 258
Occupation: Genius
cwarn23 is offline Offline
3,004 posts
since Sep 2007
Feb 27th, 2009
0

Re: contact form

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
Reputation Points: 6
Solved Threads: 0
Junior Poster in Training
rohnni is offline Offline
58 posts
since Feb 2009
Feb 27th, 2009
0

Re: contact form

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...
Reputation Points: 6
Solved Threads: 0
Junior Poster in Training
rohnni is offline Offline
58 posts
since Feb 2009
Feb 27th, 2009
0

Re: contact form

Click to Expand / Collapse  Quote originally posted by rohnni ...
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.
Reputation Points: 16
Solved Threads: 9
Junior Poster
ingeva is offline Offline
106 posts
since Jul 2008
Feb 27th, 2009
0

Re: contact form

php Syntax (Toggle Plain Text)
  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.
Reputation Points: 6
Solved Threads: 0
Junior Poster in Training
rohnni is offline Offline
58 posts
since Feb 2009
Feb 27th, 2009
0

Re: contact form

Click to Expand / Collapse  Quote originally posted by rohnni ...
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..

}
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Swapsry is offline Offline
19 posts
since Feb 2009
Feb 27th, 2009
0

Re: contact form

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?
Sponsor
Featured Poster
Reputation Points: 410
Solved Threads: 258
Occupation: Genius
cwarn23 is offline Offline
3,004 posts
since Sep 2007
Feb 27th, 2009
0

Re: contact form

php Syntax (Toggle Plain Text)
  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.
Reputation Points: 6
Solved Threads: 0
Junior Poster in Training
rohnni is offline Offline
58 posts
since Feb 2009
Feb 27th, 2009
0

Re: contact form

Click to Expand / Collapse  Quote originally posted by Swapsry ...
Hi ..

you have to close one if condition at last..

}

i did bt nothing happened.. same error
Reputation Points: 6
Solved Threads: 0
Junior Poster in Training
rohnni is offline Offline
58 posts
since Feb 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Result without while loop
Next Thread in PHP Forum Timeline: pacific time





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC