Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP Contact Form won't send from mobile device
    primarykey
    data
    text
    <p>I pulled this code off some site to use in various forms on my website. But I had a friend text me today saying "hey I tried to contact you through your website." Which set off an alarm in my head... "you TRIED?" So I went into heavy test mode, and it seems the only thing my forms don't get emailed to my account is when I submit them from my phone. The worst part is that the site treats the submit as if the form was sent. There is no error message. Here is the code: ` <pre><code> $email_to = "info@optiprintdesign.com"; $email_subject = "Contact Form Message - Opti Print and Design"; function died($error) { echo "We are very sorry, but there were error(s) found with the form you submitted. "; echo "These errors appear below.&lt;br /&gt;&lt;br /&gt;"; echo $error."&lt;br /&gt;&lt;br /&gt;"; echo "Please go back and fix these errors.&lt;br /&gt;&lt;br /&gt;"; die(); } if(!isset($_POST['username']) || !isset($_POST['usercompany']) || !isset($_POST['email']) || !isset($_POST['userphone']) || !isset($_POST['usersite']) || !isset($_POST['userlocation']) || !isset($_POST['comments'])) { died('We are sorry, but there appears to be a problem with the form you submitted.'); } $username = $_POST['username']; $usercompany = $_POST['usercompany']; $email_from = $_POST['email']; $userphone = $_POST['userphone']; $usersite = $_POST['usersite']; $userlocation = $_POST['userlocation']; $comments = $_POST['comments']; $error_message = ""; $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/'; if(!preg_match($email_exp,$email_from)) { $error_message .= 'The Email Address you entered does not appear to be valid.&lt;br /&gt;'; } $string_exp = "/^[A-Za-z .'-]+$/"; if(!preg_match($string_exp,$username)) { $error_message .= 'The Name you entered does not appear to be valid.&lt;br /&gt;'; } if(strlen($comments) &lt; 2) { $error_message .= 'The Comments you entered do not appear to be valid.&lt;br /&gt;'; } if(strlen($error_message) &gt; 0) { died($error_message); } $email_message = "Form details below.\n\n"; function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,"",$string); } $email_message .= "Name: ".clean_string($username)."\n"; $email_message .= "Company: ".clean_string($usercompany)."\n"; $email_message .= "Email: ".clean_string($email_from)."\n"; $email_message .= "Phone: ".clean_string($userphone)."\n"; $email_message .= "Website: ".clean_string($usersite)."\n"; $email_message .= "Location: ".clean_string($userlocation)."\n"; $email_message .= "Comments: ".clean_string($comments)."\n"; @mail($email_to, $email_subject, $email_message, $headers); ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload