...

View Full Version : Redirect Registrant to Different HTML Page Upon Submit



fortuna61
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.

owt200x
11-07-2008, 06:32 AM
i dont know exactly how to do that, but it can be done in php

itsallkizza
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.

gnomeontherun
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" />
</form>

You then access the variable in PHP and redirect as appropriate


<?php
$code = $_POST['code'];

switch($code) {
case "CODENUMBER1": require("code1.php");
break;
case "CODENUMBER2": require("code2.php");
break;
default: require("nocode.php");
break;
}
?>


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.
http://www.w3schools.com/php/php_forms.asp



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum