| | |
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.
http://syntax.cwarn23.net/
My favourite PC. - Oopy Doopy Do 2U2!
http://syntax.cwarn23.net/
Smilies: ^_* +_+ v_v -_- *~*` My favourite PC. - Oopy Doopy Do 2U2!
•
•
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.
http://syntax.cwarn23.net/
My favourite PC. - Oopy Doopy Do 2U2!
http://syntax.cwarn23.net/
Smilies: ^_* +_+ v_v -_- *~*` My favourite PC. - Oopy Doopy Do 2U2!
•
•
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
Views: 858 | Replies: 20
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax alexa apache api array beginner beneath binary broadband broken cakephp checkbox class cms code cron curl database date directory display download dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla jquery limit link login loop mail menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion redirect regex remote script search select server sessions sms smtp soap source space speed sql structure syntax system table tutorial update updates upload url validation validator variable video web xml youtube






