Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Nov 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Redirect Registrant to Different HTML Page Upon Submit

    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.

  • #2
    Regular Coder
    Join Date
    Sep 2008
    Location
    Oklahoma
    Posts
    249
    Thanks
    11
    Thanked 13 Times in 13 Posts
    i dont know exactly how to do that, but it can be done in php

  • #3
    Senior Coder
    Join Date
    Oct 2008
    Location
    Long Beach
    Posts
    1,196
    Thanks
    36
    Thanked 164 Times in 164 Posts
    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.
    Feel free to e-mail me if I forget to respond ;)
    ohsosexybrit@gmail.com

  • #4
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    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)

    Code:
    <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:
    <?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
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •