getting posted form data into database

Discussion in 'PHP' started by terrence, Oct 30, 2004.

  1. #1
    I have an HTML Donation form that posts to a payment gateway. I do not have access to edit the payment gateway page. The HTML form is not on a secure server so I only collect non secure information such as amount, fName, lName, address, city, state, zip & 2 custom fields- message & special before posting to the gateway page where the secure credit card info is gathered. After the donation process, the end user is taken to a receipt php page I created that echoes the non-secure field values. Is it possible to INSERT the non-secure fields/values from the receipt page into a database? The Merchant needs the information to complete the donation. My receipt page does work, the code is as follows:

    <html>
    <head>
    </head>
    Code (markup):
    <?php
    $billTo_firstName=$HTTP_POST_VARS['billTo_firstName'];
    $billTo_lastName=$HTTP_POST_VARS['billTo_lastName'];
    $billTo_street1=$HTTP_POST_VARS['billTo_street1'];
    $billTo_city=$HTTP_POST_VARS['billTo_city'];
    $billTo_state=$HTTP_POST_VARS['billTo_state'];
    $billTo_postalCode=$HTTP_POST_VARS['billTo_postalCode'];
    $billTo_email=$HTTP_POST_VARS['billTo_email']; 
    $amount=$HTTP_POST_VARS['amount']; 
    $message=$HTTP_POST_VARS['message'];
    $special=$HTTP_POST_VARS['special'];
    ?>
    PHP:
    <body>
    <table cellspacing="2" cellpadding="2" width="600">
      <tr>
         <td align="center">Field</td>
        <td align="center">Value</td>
      </tr>
      <tr>
        <td>billTo_firstName</td>
        <td><?php echo $billTo_firstName; ?></td>
      </tr>
      <tr>
        <td>billTo_lastName</td>
        <td><?php echo $billTo_lastName; ?></td>
      </tr>
      <tr>
        <td>billTo_street1</td>
        <td><?php echo $billTo_street1; ?></td>
      </tr>
      <tr>
        <td>billTo_city</td>
        <td><?php echo $billTo_city; ?></td>
      </tr>
       <tr> 
        <td>billTo_state</td>
        <td><?php echo $billTo_state; ?></td>
      </tr>
       <tr>
        <td>billTo_postalCode</td>
        <td><?php echo $billTo_postalCode; ?></td>
      </tr>
      <tr>
        <td>billTo_email</td>
        <td><?php echo $billTo_email; ?></td>
      </tr>
      <tr>
        <td>amount</td>
        <td><?php echo $amount; ?></td>
      </tr>
      <tr>
        <td>message</td>
        <td><?php echo $message; ?></td>
      </tr>
      <tr>
        <td>special</td>
        <td><?php echo $special; ?></td>
      </tr>
    </table>
    </body>
    </html>
    Code (markup):
    I appreciate any help I could get on this matter.

    t
     
    terrence, Oct 30, 2004 IP
  2. Foxy

    Foxy Chief Natural Foodie

    Messages:
    1,614
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Foxy, Oct 31, 2004 IP
  3. rob watts

    rob watts Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yes, if you insert into your receipt.php page some code similar to

    
    <?
    //db vars best referenced via an include outside of root. 
    //Here for illustration purposes
    $DBName = "dbname";
    $Link = mysql_connect ($Host, $User, $Password);
    //change fieldname to correspond to the column names in your db 
      $qry="insert into tablename values 
    ('$fieldname, '$fieldname2', '$fieldname3' )";
     $result = mysql_db_query ($DBName, $qry ,$Link);
    
    //continue to output html receipt page
    //using the variables received
    ?>
    <html>
    <head> 
    </head>
    <body>
    Thanks <?=$billTo_firstName;?>
    </body></html>
    
    
    
    PHP:
     
    rob watts, Oct 31, 2004 IP