Form Processing Issue

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • parjanyew
    New Member
    • Feb 2007
    • 1

    Form Processing Issue

    Hi, I am working on a somewhat complicated form wherein I am collecting data for a client and then submitting the data for credit card processing and submitting it to a gateway and sending a confirming email to both the client and the regstrant. Everything is working great except one small issue. In some cases there is a promotional cide that is sumitted in the form that offers a discounted function. I need to check if code is valid and if it is not, stop, the process and alert the user that he needs to go back and enter a valid code.

    Again this is not an issue. I have the proper code and everything is fine. The problem I am having is that the rest of the process does not stop like I want it to. Here is the scenario:

    I have a form: registration.ph p that posts to regproc.php

    regproc.php gathers all of the variables calculates pricees based on criteria, etc., then I submit the data to the gateway and send the email.

    I check for the valid promotional code BEFORE I submit to the gateway. Is there a way I can stop the rest of the code in regproc.php from running if the code is invalid?

    Thanks
  • Motoma
    Recognized Expert Specialist
    • Jan 2007
    • 3236

    #2
    Originally posted by parjanyew
    I check for the valid promotional code BEFORE I submit to the gateway. Is there a way I can stop the rest of the code in regproc.php from running if the code is invalid?

    Thanks
    Welcome to theScripts.

    [PHP]
    //somewhere in the code:
    $validPromo = false;

    //later in the code
    if(!$validPromo )
    {
    header("Locatio n: error.php?error Number=5");
    }
    [/PHP]

    Your error page can then check the error number, and perform the necessary actions.

    Comment

    Working...