empty variables in php email form

localisator

New Member
I have a simple email form in a php file and i try to send emails but it seems that my variables come null. I have an echo after my code just to test if my variables have any values inside and they are not printed. The only thing that is printed is the 'done' and the 'email $to'. Do i do anything wrong? I followed this method from a post in youtube and he did the exact same thing and it worked for him. I also tried more email php files but still nothing. Here is my html and php code.php code:\[code\]<?php $name = $_GET['author'];$from = $_GET['email'];$subj = $_GET['sub'];$message = $_GET['msg'];$headers .= "From: $email";$to = "[email protected]";$subject = "$subj";$body = "$message";mail($to, $subject, $body, $headers);if(mail($to,$subject,$body,$headers)) {echo "An e-mail was sent to $to with the subject: $subject";} else {echo "There was a problem sending the mail. Check your code and make sure that the e-mail address $to is valid";}echo "done $name $from $to";?>\[/code\]html code:\[code\]<form action="formtoemail.php" method="post" enctype="text/plain"> <p> <label for="author">Name:</label> <input type="text" id="author" name="author" class="required input_field" /> </p> <p> <label for="email">Email:</label> <input type="text" id="email" name="email" class="validate-email required input_field" /> </p> <p class="no_margin_right"> <label for="subject">Subject:</label> <input type="text" name="sub" id="sub" class="input_field" /> </p> <div class="cleaner h20"></div> <label for="text">Message:</label> <textarea id="msg" name="msg" rows="0" cols="0" class="required"></textarea> <div class="cleaner h20"></div> <input type="submit" value="http://stackoverflow.com/questions/14039244/Send" id="submit" name="submit" class="submit_btn float_l" /> <input type="reset" value="http://stackoverflow.com/questions/14039244/Reset" id="reset" name="reset" class="submit_btn float_r" /> </form>\[/code\]
 
Back
Top