redirecting users to mutiple pages

I am trying to redirect users depending on there input

I am using the following script in the form:

[code]

Redeem your Gift Certificate Savings for Special Orders here:


Enter Coupon code






[/code]

the following code in my php file:

[php]<?php
$coupon_code = $_POST[‘couponcodenumber’];

if ($coupon_code = $some_other_value) {

$redirected_address = 'Location: specialordersDiscountForm.php';
header ($redirected_address);
exit();

} else {
$redirected_address = ‘Location: specialorderwrongcode.php’;
header ($redirected_address);
exit();
}
?>[/php]

Trying to direct them to one page if they enter the wrong code and to another if they enter the right code. Not sure where I am going wrong :(. If anyone can help me out here I would greatly appreciate it.

Thanks!

Your code should work

except $coupon_code = post is looking for “couponcodenumber”

It does not exist on your form. You have “CouponCode” as the text field there.

Also, case is extrememly important in forms and PHP, so capitals are very very important!

Hope that helps…

That helped tremendously, thanks! I finally got it after a long week.

You are very welcome. I had a lot of trouble with PHP at first and now throwing in Javascript on the html. Most of which turned out to be simple spelling errors or wrong variable selected.

It’s a warm and fuzzy feeling when it finally works! Congrats! :smiley:

Sponsor our Newsletter | Privacy Policy | Terms of Service