Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(E_NOTICE);
- function valid_email($str)
- {
- return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $str)) ? FALSE : TRUE;
- }
- if($_POST['first_name']!='' && $_POST['last_name']!='' && $_POST['e_mail']!='' && $POST['phone']!='' && valid_email($_POST['e_mail'])==TRUE)
- {
- $to = '[email protected]';
- $headers = 'From: '.$_POST['e_mail'].''. "\r\n" .
- 'Reply-To: '.$_POST['e_mail'].'' . "\r\n" .
- 'X-Mailer: PHP/' . phpversion();
- $subject = "Contact from IC website";
- $message = 'Name: ' . $_POST['first_name'].' '. $POST['last_name'] . "\r\n" .
- 'Phone: ' . $POST['phone'] . "\r\n" .
- 'Referred by: ' . $POST['referred_by'] . "\r\n" .
- 'Event type: ' . $POST['event_type'] . "\r\n" .
- 'Event date: ' . $POST['event_date'] . "\r\n" .
- 'Venue: ' . $POST['venue'] . "\r\n" .
- 'Number of guests: ' . $POST['num_guests'] . "\r\n" .
- 'Budget: ' . $POST['budget'] . "\r\n" .
- 'Decor required: ' . "\r\n" .
- ' Entry: ' . $POST['entry'] . "\r\n" .
- ' Dance floor: ' . $POST['dance_floor'] . "\r\n" .
- ' Stage: ' . $POST['stage'] . "\r\n" .
- ' Ceiling: ' . $POST['ceiling'] . "\r\n" .
- ' Table: ' . $POST['table'] . "\r\n" .
- htmlspecialchars($_POST['themessage']);
- if(mail($to, $subject, $message, $headers))
- {//we show the good guy only in one case and the bad one for the rest.
- echo 'Thank you '.$_POST['first_name'].'. Your message was sent';
- }
- else {
- echo "Message not sent. Please make sure you're not
- running this on localhost and also that you
- are allowed to run mail() function from your webserver";
- }
- }
- else {
- echo 'Please make sure you filled all the required fields,
- and that you entered a valid email and phone.';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement