email - PHP message sends "undefined" -
i have mail.php sends out email. code i'm using.
<?php if(isset($_post['submit'])){ $to = $_post['email']; $subject = 'your results!'; $message = $_post['message']; $headers = 'from: example@example.com' . "\r\n" . 'reply-to: example@example.com' . "\r\n" . 'x-mailer: php/' . phpversion(); //mail($to, $subject, $message, $headers); //header("location: thankyou.php"); echo $message; } ?>
the contents of email supposed .innertext of of div have on index.php page. if echo out message, output appears page (mail.php) when comment/uncomment necessary parts email myself message receive "undefined".
is $message not defined?
here form , javascript i'm using
<form action="mail.php" method="post" onsubmit="this.message.value = document.getelementbyid('box').innertext;"> <input type="email" name="email" required> <input id="content" type="hidden" name="message" value=""> <input type="submit" name="submit"> </form>
change .innertext
.textcontent
. .innertext
nonstandard property doesn't exist in firefox.
i don't know why didn't have same problem when used echo $message
in php script, unless tested version of script different browser (always try minimize number of differences when you're testing this).
Comments
Post a Comment