passing form data?

Discussion in 'PHP' started by gonzobob, Dec 5, 2007.

  1. #1
    I am trying to pass an email variable from a signup form to a second page, before finally posting the output to an order form.

    The first form will look like this:

    <head>
    <title>Form</title>
    </head>
    <body>
    <form action="signup2.php" method="post" target="_self">
    email: <input name="email" id="email" type="text"><br />
    <input type="submit">
    </form>
    </body>
    </html>  
    PHP:
    There is a second form submission on "signup2.php" that points to a particular header redirect.

    I don't understand how to get the email variable passed from a text box on the email form to "signup2.php" and ultimately into the header redirect as shown in the code below.

    Here is the raw PHP code of "signup2.php"

    <?php 
    $paytype=${"button"};
    $payselect=${"payselect"};
    
    // ---------------------------------------------
    if ($paytype=="Pay Now")
    {
    
      switch ($payselect)
      {
        case "lifetime":
          $payVal = 1;
          break;
        case "2yr":
          $payVal = 4;
          break;
        case "1yr":
          $payVal = 9;
          break;
        default:
          $payVal = 13;
          break;
      }
      
      if ($_POST['OPTIN'] == "ON")
      {
        if ($_POST['OPTIN1'] == "ON")
        } else {
          $payVal = $payVal + 1;
        }
      } else }
        if ($_POST['OPTIN1'] == "ON")
        {
          $payVal = $payVal + 2;
        } else
        {
          $payVal = $payVal + 3;
        }
      
      header("Location: http://$payVal.publisher.pay.clickbank.net/?email=" . $_POST["email"]);
    
    
    } 
    
    
    ?>
    <form name="paymethod" action="<? echo $_SERVER["PHP_SELF"];?>" method="post"></strong>
    PHP:
    Thanks for any help.
     
    gonzobob, Dec 5, 2007 IP
  2. serialCoder

    serialCoder Guest

    Best Answers:
    0
    #2
    well you get the submitted variables through the $_POST or $_GET variables in your case

    $_POST['email] <--- will contain the submitted value of the email field
     
    serialCoder, Dec 5, 2007 IP
  3. gonzobob

    gonzobob Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    So I would replace method="post" with this?

    <form action="signup2.php" method="<?php $_POST['email'] ?> <target="_self">
    PHP:
     
    gonzobob, Dec 5, 2007 IP
  4. bartolay13

    bartolay13 Active Member

    Messages:
    735
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    98
    #4
    you dont have to put parameters on your header...
    your form in first page "action" is already redirecting you to your signup2.php

    means, all the variables will push through your second page.. try to clear all parameters first,, maybe it confuses you..

    catch the values of the variables by $_POST
    (what SerialCoder means)
     
    bartolay13, Dec 5, 2007 IP