Mous86 Posted May 24, 2012 Share Posted May 24, 2012 I have 2 forms that need to be redirected once submitted to a certain page, so far 1 works; however I am unsure how to redirect the second form...Assuming its an if and else using header location. Any ideas much appreciated Thanks, Mous CODE ------------------------------------------------------------------------------------------------------ <?php $where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/")); mail("[email protected]","Enquiry","Form data: First Name: " . $_POST['first_name'] . " Last Name: " . $_POST['last_name'] . " Email: " . $_POST['email'] . " Street: " . $_POST['street'] . " Suburb: " . $_POST['suburb'] . " Post Code: " . $_POST['post_code'] . " Ethnicity: " . $_POST['ethnicity'] . " Date of Birth - Month: " . $_POST['dobm'] . " Date of Birth - Day: " . $_POST['dobd'] . " Date of Birth - Year: " . $_POST['doby'] . " Phone: " . $_POST['contact_number1'] . " Mobile: " . $_POST['contact_number2'] . " Suitable Contact Time: " . $_POST['time'] . " Are You Overseas?: " . $_POST['overseas'] . " Date of Return - Month: " . $_POST['backm'] . " Date of Return - Day: " . $_POST['backd'] . " Date of Return - Year: " . $_POST['backy'] . " How Did You Hear About Us: " . $_POST['hear'] . " Enquiry: " . $_POST['enquiry'] . " "); include("thankyou.html"); ?> Link to comment https://forums.phpfreaks.com/topic/263033-php-if-and-else-statement-possibly-needed-when-redirecting-2-forms-on-submit/ Share on other sites More sharing options...
PravinS Posted May 24, 2012 Share Posted May 24, 2012 May this will help you if (mail(YOUR MAIL PARAMETERS)) header("Location: thankyou.html"); else header("Location: error.html"); Link to comment https://forums.phpfreaks.com/topic/263033-php-if-and-else-statement-possibly-needed-when-redirecting-2-forms-on-submit/#findComment-1348212 Share on other sites More sharing options...
Mous86 Posted May 24, 2012 Author Share Posted May 24, 2012 This php file is filtering and sending to my email as its been validated already on the client side using javascript, Some how need it to recognise the page or which form then redirect...1 form's a contact which goes to a thank you page and the other is a registering form which goes to a entry successful page Thanks for your help Link to comment https://forums.phpfreaks.com/topic/263033-php-if-and-else-statement-possibly-needed-when-redirecting-2-forms-on-submit/#findComment-1348214 Share on other sites More sharing options...
Mous86 Posted May 24, 2012 Author Share Posted May 24, 2012 May this will help you if (mail(YOUR MAIL PARAMETERS)) header("Location: thankyou.html"); else header("Location: error.html"); Just tried it, still goes to thank you page, anyway to grab form name?? maybe that'll work :-) Link to comment https://forums.phpfreaks.com/topic/263033-php-if-and-else-statement-possibly-needed-when-redirecting-2-forms-on-submit/#findComment-1348217 Share on other sites More sharing options...
Mous86 Posted May 24, 2012 Author Share Posted May 24, 2012 tried this but still won't work if ($_POST['enquiry-form']) header("Location: thankyou.html"); else header("Location: entry-successful.html"); Link to comment https://forums.phpfreaks.com/topic/263033-php-if-and-else-statement-possibly-needed-when-redirecting-2-forms-on-submit/#findComment-1348221 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.