Jump to content

Help With Inserting To Sql From Php


darrenwindle

Recommended Posts

Ok ill give the run down of the php[ and sql first before the problem.

 

table - pd_giftcert

columns - cust_id, cre_email, pd_gcnumber, timestamp, pd_expiry

 

here's the php

 

pd_giftert.php

 

<?php
session_start();
$page_title = 'My Events';
$username = $_SESSION['cre_email'];
if (!isset($_SESSION['loggedin']))
{
echo "<script language=\"Javascript\">window.location='buy.php?id=$id'</script>";
}


include("includes/headerOut.php");
include("dbconn2.php");
include("email.php");?>
<!--main Nav-->
     <?php include('includes/mainNav.php'); ?>
   <!--Section Title-->

<!--primary Content-->
   <div id="primaryContent">
    <?php include('includes/login.php'); ?>
   </div>
   <!--Main Content-->
   <div id="mainContent">
     <h1>Buy Gift Certificate</h1>
     <p></p>
     <p>Gift cards cost £20 and must be used within 6 months of purchase      </p><tr>
                 <td><h3>buy 
                      Gift Certifactes</h3></td></tr>
               <tr> 
                 <td height='102'><p>************</p></td>
               </tr>


               <tr> 
                 <td height='278' class='aligntop'><form action='https://www.paypal.com/cgi-bin/webscr' method='post'>


                       <input type='hidden' name='cmd' value='_xclick'>
                       <input type='hidden' name='business' value='bookings@************.co.uk'>

                       <input type='hidden' name='item_name' value='Gift Certificate'>
<input type='hidden' name='amount' value='20'>

<br />
<br />

   <input type='hidden' name='undefined_quantity' value='1'>
                       <input type='hidden' name='currency_code' value='GBP'>
                     <input type='hidden' name='return' value='http://www.************.co.uk/gc_thanks_payment.php'>
                       <input type='hidden' name='cancel_return' value='http://www.************.co.uk/payment_failed.html'>
                       <input type='hidden' name='receiver_email' value='bookings@************.co.uk'>
                       <input type='hidden' name='mrb' value='************'>
                       <input type='hidden' name='pal' value='************'>  
                       <input type='hidden' name='no_shipping' value='0'>
                       <input type='hidden' name='no_note' value='1'>


                      <br /><input type='image' name='submit' src='images/continue.gif' border='0' alt='continue to secure server'>
                     </p>
                   </form>

</p>

   </div>
   <!--primary Content-->
   <div id="primaryContent">
   <?php include('includes/newEvents.php'); ?>
   </div>
   <!--Footer-->
<?php include('includes/footer.php'); ?>
 </div>
</div>
</body>

 

I need to enter a random 8-16 digit number that is unique in the gc_number column upon clicking the ontinue button on this page. I then need to make sure it is linked to the logged in user who is buying the gift certificate. Also I need to generate a thanks payment page that shows the unique gift certificate with the number that is generated and the email that it is linked to. All this must be inserted into the db table above with all the otjher relevant info. How can I do this. Any help would be appreciated. Thanks

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.