Monday, 15 July 2013

php - Email not triggering on redirect to page -



php - Email not triggering on redirect to page -

i have form triggers email on submit want redirect different page on submit.

at moment email comes through next (i.e reloading same page):

<form id="customisesystem" name="enquiry" onsubmit="return formcheck(this);" method="post" action="<?php echo the_permalink(); ?>">

i want alter following:

<form id="customisesystem" name="enquiry" onsubmit="return formcheck(this);" method="post" action="<?php bloginfo('url'); ?>/thank-you">

this doesn't trigger email.

can see going wrong?

this script sends email.

<? if(isset($_post['submit'])) { $to = "rob@domain.com"; $header = 'from: admin@domain.com'; $subject = "quotation"; $enquiry_first_name = $_post['enquiryfirstname']; $enquiry_last_name = $_post['enquirylastname']; $enquiry_title = $_post['enquirytitle']; $enquiry_organisation = $_post['enquiryorganisation']; $enquiry_address = $_post['enquiryaddress']; $enquiry_country = $_post['enquirycountry']; $enquiry_email_address = $_post['enquiryemailaddress']; $enquiry_telephone = $_post['enquirytelephone']; $enquiry_additional_comments = $_post['enquiryadditionalcomments']; $enquiry_product = get_the_title(); if(!empty($_post['hardware'])) { foreach($_post['hardware'] $check) { $hardwareresults .= $check."\n"; } } if(!empty($_post['systems'])) { foreach($_post['systems'] $check) { $systemsresults .= $check."\n"; } } $productresults = ""; $quantities = array_combine($_post['product'], $_post['quantity']); foreach ($quantities $product => $quantity) { if ($quantity > 0) { $productresults .= "$quantity x $product \n"; } } $body = "you have quote request website: name: $enquiry_title $enquiry_first_name $enquiry_last_name type of organisation: $enquiry_organisation address: $enquiry_address, $enquiry_country e-mail: $enquiry_email_address tel: $enquiry_telephone comments: $enquiry_additional_comments send more info on: $systemsresults quotation: $enquiry_product hardware: $hardwareresults accessories: $productresults kind regards"; mail($to, $subject, $body, $header); echo "thank enquiry."; } ?>

keep using <?php echo the_permalink(); ?> sends email

and after email code have used echo "thank enquiry."; replace

header('location: ' . bloginfo('url') . '/thank-you');

edit

to posted info within give thanks page, should pass info mail service page.

there 2 ways can send info on other page in situation

use methods. `/thank-you/?name=abc&age=xyz store values in session , access them on session page

edit

try this

header('location: http://www.yourblog.com/thank-you/?title=' . $enquiry_title);

and in give thanks page, variable, , echo variable want display it.

<?php $title = $_get['title']; ... ?> give thanks message , html construction message titled: <b> <?php echo $title; ?> </b> received. contact shortly .... blah blah

i hope create sense.

php wordpress forms

No comments:

Post a Comment