Jump to content

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


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("test@test.com","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 :-)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.