| | |
contact form
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Feb 2009
Posts: 58
Reputation:
Solved Threads: 0
php Syntax (Toggle Plain Text)
<?php define("ContactEmail", "highwebgeeta@gmail.com"); $error_msg = 'The following fields were left empty or contain invalid information:<ul>'; $error = false; $submit = $_POST['submit']; if (empty($submit)) $form_submitted = false; else $form_submitted = true; if ($form_submitted) { $title = $_POST['title']; $name = $_POST['name']; $lname = $_POST['lname']; $address = $_POST['address']; $pin = $_POST['pin']; $country = $_POST['country']; $contact = $_POST['contact']; $email = $_POST['email']; if(!$name) { $error_msg .= "<li>Full Name</li>"; $error = true; } if(!$email) { $error_msg .= "<li>E-mail Address</li>"; $error = true; } if(!$contact) { $error_msg .= "<li>contact</li>"; $error = true; } if($email) { if(!eregi("^[a-z0-9_]+@[a-z0-9\-]+\.[a-z0-9\-\.]+$", $email)){ $error_msg .= "<li>E-mail Address</li>"; $error = true; }} $error_msg .= "</ul>"; if (!$error) { $msg = "Full Name: \t $name \n"; $msg .= "Contact: \t $contact \n"; $msg .= "E-mail Address: \t $email \n"; $msg .= "address: \n---\n $address \n---\n"; $mailheaders = "Enquiry"; $mailheaders .= "Content-type: text/plain; charset=iso-8859-1\r\n"; $mailheaders .= "From: $name <$email>\r\n"; $mailheaders .= "Reply-To: $name <$email>\r\n"; mail(ContactEmail, $subject , stripslashes($msg), $mailheaders); } } ?> <?php // email was successfully send if (($form_submitted) && (!$error)) { ?> <!-- display submitted data --> Thank you for your feedback, <?php echo $name; ?>. 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.
•
•
•
•
Originally Posted by rohnni
i create a contact form that link to 5 pages , please help me to create a contact form using php..
Also I noticed your mail function is incorrect and needs to be as follows:
php Syntax (Toggle Plain Text)
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
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
•
•
Join Date: Feb 2009
Posts: 58
Reputation:
Solved Threads: 0
php Syntax (Toggle Plain Text)
<?php define("ContactEmail", "your-email"); $error_msg = 'The following fields were left empty or contain invalid information:<ul>'; $error = false; $submit = $_POST['submit']; if (empty($submit)) $form_submitted = false; else $form_submitted = true; if ($form_submitted) { $title = $_POST['title']; $name = $_POST['name']; $lname = $_POST['lname']; $address = $_POST['address']; $pin = $_POST['pin']; $country = $_POST['country']; $contact = $_POST['contact']; $email = $_POST['email']; if(!$name) { $error_msg .= "<li>Full Name</li>"; $error = true; } if(!$email) { $error_msg .= "<li>E-mail Address</li>"; $error = true; } if(!$contact) { $error_msg .= "<li>contact</li>"; $error = true; } if($email) { if(!eregi("^[a-z0-9_]+@[a-z0-9\-]+\.[a-z0-9\-\.]+$", $email)){ $error_msg .= "<li>E-mail Address</li>"; $error = true; }} $error_msg .= "</ul>"; if (!$error) { $msg = "Full Name: \t $name \n"; $msg .= "Contact: \t $contact \n"; $msg .= "E-mail Address: \t $email \n"; $msg .= "address: \n---\n $address \n---\n"; $mailheaders = "Enquiry"; $mailheaders .= "Content-type: text/plain; charset=iso-8859-1\r\n"; $mailheaders .= "From: $name <$email>\r\n"; $mailheaders .= "Reply-To: $name <$email>\r\n"; mail("your-email", $subject , stripslashes($msg), $mailheaders); } ?> <?php // email was successfully send if (($form_submitted) && (!$error)) { ?> <!-- display submitted data --> Thank you for your feedback, <?php echo $name; ?>. 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.
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
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
•
•
Join Date: Feb 2009
Posts: 58
Reputation:
Solved Threads: 0
php Syntax (Toggle Plain Text)
<?php define("ContactEmail", "highwebgeeta@gmail.com"); $error_msg = 'The following fields were left empty or contain invalid information:<ul>'; $error = false; $submit = $_POST['submit']; if (empty($submit)) $form_submitted = false; else $form_submitted = true; if ($form_submitted) { $title = $_POST['title']; $name = $_POST['name']; $lname = $_POST['lname']; $address = $_POST['address']; $pin = $_POST['pin']; $country = $_POST['country']; $contact = $_POST['contact']; $email = $_POST['email']; if(!$name) { $error_msg .= "<li>Full Name</li>"; $error = true; } if(!$email) { $error_msg .= "<li>E-mail Address</li>"; $error = true; } if(!$contact) { $error_msg .= "<li>contact</li>"; $error = true; } if($email) { if(!eregi("^[a-z0-9_]+@[a-z0-9\-]+\.[a-z0-9\-\.]+$", $email)){ $error_msg .= "<li>E-mail Address</li>"; $error = true; }} $error_msg .= "</ul>"; if (!$error) { $msg = "Full Name: \t $name \n"; $msg .= "Contact: \t $contact \n"; $msg .= "E-mail Address: \t $email \n"; $msg .= "address: \n---\n $address \n---\n"; $mailheaders = "Enquiry"; $mailheaders .= "Content-type: text/plain; charset=iso-8859-1\r\n"; $mailheaders .= "From: $name <$email>\r\n"; $mailheaders .= "Reply-To: $name <$email>\r\n"; mail("highwebgeeta@gmail.com", $subject , stripslashes($msg), $mailheaders); } ?> <?php // email was successfully send if (($form_submitted) && (!$error)) { ?> <!-- display submitted data --> Thank you for your feedback, <?php echo $name; ?>. This is the information you submitted:<br><br><?php echo nl2br(stripslashes($msg)); ?>
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.
![]() |
Similar Threads
- Need Web Based Contact Us Form (PHP)
- Do you know any good contact form script (HTML and CSS)
- Contact form Flash/PHP sends with Text Formatting (PHP)
- PHP Contact form (PHP)
- Need a contact form (HTML and CSS)
- Need a contact form for my web site (Site Layout and Usability)
- Auto fill-in a field on the contact form (HTML and CSS)
- Contact form without scipts (PHP)
- Removing pictures from Outlook 2003 Contact form (Windows Software)
Other Threads in the PHP Forum
- Previous Thread: Ajax Search as google?
- Next Thread: pacific time
| Thread Tools | Search this Thread |
ajax apache api array beginner binary body broken buttons cakephp checkbox class cms code cron curl database date date/time display dynamic ebooks echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link login loop mail mediawiki menu mlm msqli_multi_query multiple mysql number oop paypal pdf php phpincludeissue phpmyadmin problem query radio random recursion regex remote script search server sessions sms soap source sp space speed sql static subdomain syntax system table tag tutorial update upload url validation validator variable vbulletin video web websphere white xml youtube






