Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP form sending error
    primarykey
    data
    text
    <p>I will start off by saying I am not a coder and would really like some help. </p> <p>My <code>contact.php</code> form keeps returning this error message: </p> <pre><code>Invalid email address entered </code></pre> <p>when I test it on a server.</p> <p>I have used this <code>contact.php</code> form for a different website and it works fine. I read that the php code may now be deprecated but I'm not sure how to fix it. </p> <p>This is the php code:</p> <pre><code>&lt;?php if(!$_POST) exit; $email = $_POST['email']; //$error[] = preg_match('/\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i', $_POST['email']) ? '' : 'INVALID EMAIL ADDRESS'; if(!preg_match('/\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i',$email )){ $error.="Invalid email address entered"; $errors=1; } if($errors==1) echo $error; else{ $values = array ('name','email','message'); $required = array('name','email','message'); $your_email = "dimasir@yahoo.com"; $email_subject = "New Message: ".$_POST['subject']; $email_content = "new message:\n"; foreach($values as $key =&gt; $value){ if(in_array($value,$required)){ if ($key != 'subject' &amp;&amp; $key != 'company') { if( empty($_POST[$value]) ) { echo 'PLEASE FILL IN REQUIRED FIELDS'; exit; } } $email_content .= $value.': '.$_POST[$value]."\n"; } } if(@mail($your_email,$email_subject,$email_content)) { echo 'Message sent!'; } else { echo 'ERROR!'; } } ?&gt; </code></pre> <p>edit original note****This is my HTML code: </p> <p> </p> <pre><code> &lt;form method="post" action="contact.php"&gt; &lt;input type="hidden" name="send" value="1" /&gt; &lt;fieldset&gt; &lt;label&gt;First Name &lt;/label&gt; &lt;input name="" type="text" class="filed1" /&gt; &lt;label&gt;Last Name&lt;/label&gt; &lt;input name="" type="text" class="filed1" /&gt; &lt;label&gt;Your Email &lt;/label&gt; &lt;input name="" type="text" class="filed1" /&gt; &lt;label&gt;Company&lt;/label&gt; &lt;input name="" type="text" class="filed1" /&gt; &lt;label&gt;Message &lt;/label&gt; &lt;textarea name="" cols="" rows="" &gt;&lt;/textarea&gt; &lt;input type="image" src="images/send.jpg" /&gt; &lt;/fieldset&gt; &lt;/form&gt; &lt;/div&gt; &lt;!-- \ CONTACT BOX / --&gt; &lt;/div&gt; </code></pre> <p> </p>
    singulars
    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.
 

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