Jump to content

Recommended Posts

I need to redirect to a static thankyou page after a user submit the form. I used header("Location: thankyou.html"); to redirect the page but it is NOT working ... Please let me know what is the best way to redirect this different page after form submission.

 

<?php

error_reporting(E_PARSE);

define("ADMIN_MAIL", "jb@bwp.net");

define("HOST_NAME", $_SERVER['HTTP_HOST']);

define("PHP_SELF", $_SERVER['PHP_SELF']);

define('FORM_RECIPIENT', 'webmaster@lenapebuilder.net');

$isHideForm = false;

if( $HTTP_POST_VARS["formmail_submit"] ){

header("Location: thankyou.html");

exit();

}

?>

 

<?php

 

$ip = $_POST['ip'];

$httpref = $_POST['httpref'];

$httpagent = $_POST['httpagent'];

$customer_name = $_POST['customer_name'];

$customer_email = $_POST['customer_email'];

$customer_address = $_POST['customer_address'];

$customer_city = $_POST['customer_city'];

$customer_state = $_POST['customer_state'];

$customer_zip = $_POST['customer_zip'];

$customer_phone = $_POST['customer_phone'];

$customer_email = $_POST['customer_email'];

 

$subject = CustomerContact_Form;

 

$message = " $todayis [EST] \n

Name:  $customer_name \n

Address: $customer_address \n

City: $customer_city \n

State: $customer_state \n

Zip: $customer_zip \n

Phone: $customer_phone \n

";

 

$from = "From: $customer_email\r\n";

mail("webmaster@lenape.net", $subject, $message, $from );

?>

Link to comment
https://forums.phpfreaks.com/topic/90809-redirect-to-thankyou-page/
Share on other sites

This makes no sense to me.  Since there is no FORM on that page, is this being called from another page?  If so, and the header does work, that means all the code below it won't even get called.

 

May also want to use $_POST as well.

Most people have javascript enabled.

 

Most isn't all. If you are doing an amateur site it doesn't matter, but if you are programming real, professional sites, that fact cannot be overlooked.

 

Most is the majority, your chances of someone being the minority of that group would be low.

 

 

Go with HEADER("Location:index.php") or something...

 

Or you can use a cheap meta refresh method

 

<meta http-equiv="refresh" content="15;url=http://www.codeave.com">

Like I say, you can afford to ignore the minority if you are making amateur sites. I unfortunately don't have that freedom. Although that requirement also makes me learn to program properly instead of easily.

 

As for as not having javascript turned on, in my company none of us do - company requirement due to security reasons.

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.