11-06-2008, 11:24 PM
I am developing a registration form and need to have the registrant enter a text discount code in the form field and then have them redirected to a html payment page. The hook is that there are two discount codes that need to be redirected to two payment page. If the registrant leaves the field blank and submits the form they are taken to a third payment page.
I need to know know how to code this or where to find coding instructions. This form is for a seminar scheduled for November 22, 2008 and I am desperate for a solution. Thank you in advance for your support and cooperation.
11-07-2008, 06:32 AM
i dont know exactly how to do that, but it can be done in php
11-07-2008, 06:42 AM
Where are the discount codes stored? I hope not client side, or anyone can see/use them. Although it sounds to me as if they are...
Anyway, once you tell me how/where they are stored (eg in your JS - bad idea -, in a sql database, in some sort of serverside conditional, etc) I can help you create your form.
11-07-2008, 02:57 PM
Using PHP you take the results from the code, and compare it against an array of possible codes.
So you have a form with this (simplified)
<form action="process.php" method="post">
Code: <input type="text" id="code" name="code" />
<input type="submit" value="Send" />
You then access the variable in PHP and redirect as appropriate
$code = $_POST['code'];
case "CODENUMBER1": require("code1.php");
case "CODENUMBER2": require("code2.php");
And it will take the code, check it against whatever is in the "" after case, and if it matches will take the file listed afterwords and insert it into the document.
Here is a quick tutorial as well.