Jump to content

[SOLVED] can't seem to get mail form working


generic

Recommended Posts

Hi, I'm a graphic designer with very limited programming experience and this is just not working for me. When I try to submit the form using the following code, the form does nothing. It doesn't even submit at all. Anyone spot anything that might be causing this (aside from the general sloppiness of the code itself)? Thanks in advance!

 

Gen

 

<?php

if (isset($_POST['submit'])){
        
        $to = "[email protected]";
        $subject = "website contact";
    
        $name = $_POST['name'];
        $phone = $_POST['phone'];
        $email = $_POST['email']; 
        $query = $_POST['query'];
$strbody="Name:".$name."\r\n Phone :".$phone."\r\n Email :".$email."\r\n Query :".$query."\r\n"; 

mail($to, $subject, $strbody); 
        
        echo "<p>Success!</p>";
    
    } else {
    
        echo "<form id=\"contact\" name=\"contact_form\" method=\"post\" action=\"".$_SERVER['PHP_SELF']."\">
	<p class=\"contact_label\">Your Name:<br />
            <input name=\"name\" type=\"text\" /><br />
            Your Email:<br />
            <input name=\"email\" type=\"text\" /><br />
            Your Phone Number:<br />
            <input name=\"phone\" type=\"text\" /><br />
            Question/Comment:<br />
            <textarea name=\"query\" cols=\"\" rows=\"4\"></textarea>
          </p>
          <p>
            <input name=\"submit\" id=\"submit\" type=\"button\" value=\"Send It\" style=\"width: auto;\" />
          </p>
	 </form>";
}
        
    ?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.