php - contents of text area not posting -
php - contents of text area not posting -
i have form located @ https://pnrbuilder.com/_popups/feedback_popup.html
the form uses post pass input php page sends email contents of post redirects user.
the input fields work fine textarea content doesnt create email.
any thought im doing wrong?
the php page:
<?php /* first bit sets email address want form submitted to. need alter value valid email address can access. */ $webmaster_email = "support@email.com"; /* bit sets urls of supporting pages. if alter names of of pages, need alter values here. */ $feedback_page = "feedback_form.html"; $error_page = "error_message.html"; $thankyou_page = "thank_you.html"; /* next bit loads form field info variables. if add together form field, need add together here. */ $emailaddress = $_post['emailaddress'] ; $issuetype = $_post['issuetype'] ; $comments = $_post['comments'] ; /* next function checks email injection. specifically, checks carriage returns - typically used spammers inject cc list. */ function isinjected($str) { $injections = array('(\n+)', '(\r+)', '(\t+)', '(%0a+)', '(%0d+)', '(%08+)', '(%09+)' ); $inject = join('|', $injections); $inject = "/$inject/i"; if(preg_match($inject,$str)) { homecoming true; } else { homecoming false; } } // if email injection detected, redirect error page. if ( isinjected($emailaddress) ) { header( "location: $error_page" ); } // if passed previous test, send email redirect give thanks page. else { mail( "$webmaster_email, test@email.com", "feedback", $emailaddress, $issuetype, $comments ); header( "location: $thankyou_page" ); } ?>
if set below @ top of php page echo out contents of textarea
echo $_post["emailaddress"]; echo $_post["issuetype"]; echo $_post["comments"];
sending email
you're passing wrong parameters mail()
:
mail( "$webmaster_email, designedondemandcorp@gmail.com", "feedback", $emailaddress, $issuetype, $comments);
that should be:
$contents = <<<eom email: $emailaddress issue type: $issuetype comments: $comments eom; mail( "$webmaster_email, designedondemandcorp@gmail.com", "feedback", $contents);
email validation
secondly, should utilize proper email validation:
$emailaddress = filter_input(input_post, 'emailaddress', filter_validate_email); if ($emailaddress === false) { header( "location: $error_page" ); }
php html forms post textarea
Comments
Post a Comment