Jump to content

PHP if and else statement possibly needed when redirecting 2 forms on submit??


Mous86

Recommended Posts

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");

 

?>

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

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 :-)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.