new... need some help, please!

I’m completely new to PHP and can’t understand why it’s redirecting me but I’m not receiving the emails. (I have double checked the spelling of my email address.) Am I missing something? Help?

My PHP

<?php if(!isset($_POST['submit'])) { //This page should not be accessed directly. Need to submit the form. echo "error; you need to submit the form!"; } $name2 = $_POST['name2']; $name3 = $_POST['name3']; $email = $_POST['email']; $how = $_POST['how']; $subject = $_POST['subject']; $message = $_POST['message']; $email_from = '[email protected]'; $email_subject = "New Form Submission"; $email_body = "You have received a new message from the user $name.\n". "Here is the message:\n $message". $to = "[email protected]"; $headers = "From: $email_from \r\n"; $headers .= "Reply-To: $visitor_email \r\n"; mail($to,$email_subject,$email_body,$headers); header('Location: index.html'); // Function to validate against any email injection attempts function IsInjected($str) { $injections = array('(\n+)', '(\r+)', '(\t+)', '(%0A+)', '(%0D+)', '(%08+)', '(%09+)' ); $inject = join('|', $injections); $inject = "/$inject/i"; if(preg_match($inject,$str)) { return true; } else { return false; } } ?>

My HTML

Email Form

Once you submit, you will be redirected to the home page.

                              <li id="li_1" >
                  <label class="description" for="name1">Name </label>
                  <span>
                      <input name= "name2" class="element text" maxlength="255" size="8" value=""/>
                      <label>First</label>
                  </span>
                  <span>
                      <input name= "name3" class="element text" maxlength="255" size="14" value=""/>
                      <label>Last</label>
                  </span> 
                  </li>		<li id="li_2" >
                  <label class="description" for="email">Email </label>
                  <div>
                      <input name="email" class="element text medium" type="text" maxlength="255" value=""/> 
                  </div> 
                  </li>		<li id="li_3" >
                  <label class="description" for="how">How did you find Equate Designs? </label>
                  <div>
                      <input name="how" class="element text medium" type="text" maxlength="255" value=""/> 
                  </div> 
                  </li>		<li id="li_5" >
                  <label class="description" for="subject">Subject </label>
                  <div>
                      <input name="subject" class="element text medium" type="text" maxlength="255" value=""/> 
                  </div> 
                  </li>		<li id="li_4" >
                  <label class="description" for="message">Message </label>
                  <div>
                      <textarea name="message" class="element textarea medium"></textarea> 
                  </div> 
                  </li>
                      
                              <li class="buttons">
                          <input name="submit" input type="submit" value="Submit" />
                          
                        
                  </li>
                      </ul>
                  </form>	<script language="JavaScript">

// Code for validating the form
// Visit http://www.javascript-coder.com/html-form/javascript-form-validation.phtml
// for details
var frmvalidator = new Validator(“myemailform”);
frmvalidator.addValidation(“name”,“req”,“Please provide your name”);
frmvalidator.addValidation(“email”,“req”,“Please provide your email”);
frmvalidator.addValidation(“email”,“email”,“Please enter a valid email address”);

Did you check the SPAM folder on your Gmail? Also you can try to remove \r from the email headers.

Sponsor our Newsletter | Privacy Policy | Terms of Service