Jump to content

form add to database & submit to paypal


rabidbeast

Recommended Posts

Hi i am trying to make an order form which a user will fill in, and will then be inserted into the database and then the details to be submitted to paypal for payment. I have looked at paypal codes but I cant find anyway of submitting details to the database before submitting them to paypal.

 

My code is below. Can anyone help?

 


<?php 

include 'library/connect.php';

if(isset($_POST['txtNamea'])) 
{ 
    $LL = $_POST['txtNamea'];
    $id = $_POST['txtName1'];
    $email = $_POST['txtName2'];
    $contact = $_POST['txtName3'];

    $query = "INSERT INTO detail (ll, id, date, email, contact)  
              VALUES ('$LL, '$id', NOW(), 'n', '$contact')";

    mysql_query($query) or die('Error, failed : ' . mysql_error());  


    echo "<script>window.location.href='main?page=contact';</script>"; 
    exit; 
}
?> 

<form action="" method="post" enctype="multipart/form-data" name="frmAlbum" id="frmAlbum"> 
    <table width="100%" border="0" cellpadding="2" cellspacing="1" class="table_grey"> 
        <tr>  
            <th width="150">item</th> 
            <td width="80" bgcolor="#FFFFFF"> <input name="txtNamea" type="text" id="txtNamea"></td><br> 
        </tr>
        <tr>  
            <th width="150">id</th> 
            <td width="80" bgcolor="#FFFFFF"> <input name="txtName1" type="text" id="txtName1"></td><br> 
        </tr>
        <tr>  
            <th width="150">email</th> 
            <td width="80" bgcolor="#FFFFFF"> <input name="txtName2" type="text" id="txtName2"></td><br> 
        </tr>
        <tr>  
            <th width="150">contact name</th> 
            <td width="80" bgcolor="#FFFFFF"> <input name="txtName3" type="text" id="txtName3"></td><br> 
        </tr>
        <tr>  
            <td width="150" bgcolor="#FFFFFF"> </td> 
            <td bgcolor="#FFFFFF">  

<input name="btnAdd" type="submit" id="btnAdd" value="Submit"> 
                <input name="btnCancel" type="button" id="btnCancel" value="Cancel" onClick="window.history.back();"></td> 
        </tr>

    </table>
</form>

Link to comment
https://forums.phpfreaks.com/topic/96430-form-add-to-database-submit-to-paypal/
Share on other sites

it looks like you're inserting the details here. what's the problem?

 

$query = "INSERT INTO detail (ll, id, date, email, contact)  
              VALUES ('$LL, '$id', NOW(), 'n', '$contact')";
mysql_query($query) or die('Error, failed : ' . mysql_error());

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.