email - Broken PHP contact form script -
i'm trying make contactform. , somehow won't work. tried send email mail()-function , works. i'm doing wrong , don't know what.
when click on submit button, refer mailer.php file. both file in same folder.
<?php if(isset($_post['sendbutton'])) { $to = "contact@domain.com"; $subject = "contactformulier portfolio"; $name_field = $_post['yourname']; $email_field = $_post['youremail']; $message = $_post['yourmessage']; $body = "from: $name_field\n e-mail: $email_field\n message:\n $message"; echo "data has been submitted $to!"; mail($to, $subject, $body); } else { echo "there has been error, try again please!"; } ?>
without seeing code, guess condition mailing never met because there no value set submit button. try making condition emailing this:
if($_post) { mail here } else { error case }
Comments
Post a Comment