943,832 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 9170
  • PHP RSS
Aug 5th, 2004
0

Retreiving variables from a sql query into a form

Expand Post »
I need to add a paypal 'add to cart' button to my page to submit the contents of my table to a shopping cart. The contents of the table are variables as they are from a sql query. Does anyone know hoe I could get the paypal link(script below) to retreive the variables from my query and submit them to the shopping cart.

PHP Syntax (Toggle Plain Text)
  1. <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
  2. <input type="image" src="https://www.paypal.com/en_GB/i/btn/x-click-but22.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
  3. <input type="hidden" name="add" value="1">
  4. <input type="hidden" name="cmd" value="_cart">
  5. <input type="hidden" name="business" value="info@wildcar.co.uk">
  6. <input type="hidden" name="item_name" value="">
  7. <input type="hidden" name="item_number" value="">
  8. <input type="hidden" name="amount" value="">
  9. <input type="hidden" name="no_note" value="1">
  10. <input type="hidden" name="currency_code" value="GBP">
  11. </form>

I need $myrow[0] to be used for item_number, $myrow[1],$myrow[2],$myrow[3] and $myrow[4] to be combined to make item_name and $myrow[5] to be used for Ammount.

Thanks
Huw
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
huwgomez is offline Offline
6 posts
since Aug 2004
Aug 16th, 2004
0

Re: Retreiving variables from a sql query into a form

can you provide more specifics on sql versions, platform, etc?
TKS
Reputation Points: 108
Solved Threads: 18
Posting Pro in Training
TKS is offline Offline
470 posts
since Jan 2004
Aug 17th, 2004
0

Re: Retreiving variables from a sql query into a form

Quote originally posted by TKS ...
can you provide more specifics on sql versions, platform, etc?

The Host company use Linux servers and run the latest versions of SQL & PHP

Huw
Reputation Points: 10
Solved Threads: 0
Newbie Poster
huwgomez is offline Offline
6 posts
since Aug 2004
Aug 23rd, 2004
0

Re: Retreiving variables from a sql query into a form

You could run a query like:

[php]<?php

// don't forget to create a connection to database first!

// i.e.:
@mysql_connect('localhost','username','password');

// and choose a database
@mysql_select_db('database_name');

// fetch the info from database
$myrow = @mysql_query("SELECT * FROM table");
// make it so that it's like $myrow[0], $myrow[1], etc.
$myrow = mysql_fetch_row($myrow);

?>[/php]
Team Colleague
Reputation Points: 53
Solved Threads: 5
PHP/vBulletin Guru
Gary King is offline Offline
360 posts
since Nov 2003

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Which template is it? [vbulletin]
Next Thread in PHP Forum Timeline: need help with PHP Script translation





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC