View Full Version : ? Forms, make different text lead to different links?

03-20-2008, 01:56 AM
Hello all,

Can anyone enlighten me as to how I can create a simple one line text form field which will accept different coupon codes and from there take the user to a different page based upon what text was input into the text field?

Specifically, I am trying to set up a referral page to an online store.. we are going to do a mail drop with two different coupon codes. We would like one coupon code to lead to one page, and the othe coupon code to lead to another. If no code is entered, we would like it to link to one of the two pages.

How should I go about doing this, or what should I look into.. what will I need, thank you for any help/advice you are willing to provide!


03-20-2008, 06:53 AM
what else does the form capture?

what other data do you want to collect or is it just this coupon code and is this code just there to redirect only? also does the shop use the code after the user has been directed to the page

03-20-2008, 07:23 AM
Hi David, and thank you for responding.

The data I wish to collect on our page is simply the promotional code. Ideally, there will be a space to enter the code and then there will be a “proceed to shop” or some type of icon below the coupon entry field to bypass it. If they have a promotional code, they should enter it. If not, they can simply click the 'proceed' button to skip.

There is still some coordination to be done with the merchant services account. I was thinking and hoping that I would be able to set up the promotional code entry on their end.. But in the event that's not possible I would like something to fall back on.

That being said, the shop may or may not need the promotional code. They will if they can't set up two separate URLs, but if they can set up a different checkout page for each of the two promotional codes then they would not need the code as people would be arriving at the merchant account pages based upon what promo code they input on our site. I am not at all sure how the merchant account works, I am still waiting on contact from them.

You see, someone in control of this matter has the idea to charge different prices for different codes to test the market, that's why there needs to be some secrecy involved with regard to pricing. They will mail out two different codes to different areas and see which brings the overall best response; price will not be mentioned on the mailer... only when they arrive at the website and enter their promotional codes will they be made aware of the pricing.

I hope that explains it well enough. :) Thank you again for any advice you can give.


03-21-2008, 10:13 PM
This is an ASP example that can be done in PHP as well.
Let's call the form text filed "promoCode", set method to "post" and the "action" to whatever page you want to receive the data with.

on the second page we put the following code:

<% Dim promo1, promo2
'these are the predefined codes that will be compared to the codes the user enters
promo1 = "123"
promo2 = "456"

' here we match the code sent by the form with the proper codes and reply accordingly.
if Request.Form("promoCode") = promo1 then
Response.Write "you have the promo 123"
elseif Request.Form("promoCode") = promo2 then
Response.Write "you have the promo 456"
else Response.Write "you have no promo code"
end if

You can use Response.Redirect("http://www.youurl.com") instead of Response.write to send them to where you desire.

Hope it helps.

03-23-2008, 02:25 AM
THANK YOU Mangofreak.

I was not alerted via e-mail that there was an update to this thread, so apologies for the late reply. I will attempt to apply what you have posted shortly and report back, thank you again.