baha Posted November 21, 2009 Share Posted November 21, 2009 Hi all, What I'm trying to accomplish should be simple, but I just cant figure it out . I'm trying to implement an affiliate program to my website and one line of code needs to be added to one page of my site so that the sale data is passed to the software. My site's MySql database handles sales data and the code that I need to enter needs to access two variables from the database. Here's what the affiliate software mfgr says to do... The next step is to add code to your Thank you page so that the software tracks each sale. Simply add the following code to your Thank you page so that affiliate users who earn money based upon a successful sale will get credit.<img src=https://www.mysite.com/affiliate/sale.php?amount=10&transaction=B style='visibility: hidden'> The 'amount' variable should reflect the amount of your product or service. You can either hard code this amount or dynamically populate this field by passing a variable from your shopping cart containing the sale total. 'Transaction' variable is your customer's order number. Ok, so definitely I need dynamic population because every product is a different price. In my MySql database, these two variables are used: total_order_amount and order_id . So.... what's the syntax? I tried <img src=https://www.mysite.com/affiliate/sale.php?amount=<?=$total_order_amount;?>&transaction=<?=$order_id;?> style='visibility: hidden'> but this didnt work (yes, I replaced 'mysite' with my domain ) Thanks in advance!! Link to comment https://forums.phpfreaks.com/topic/182347-mysql-variables-in-php-application/ Share on other sites More sharing options...
plznty Posted November 21, 2009 Share Posted November 21, 2009 You have the database already right? Link to comment https://forums.phpfreaks.com/topic/182347-mysql-variables-in-php-application/#findComment-962273 Share on other sites More sharing options...
plznty Posted November 21, 2009 Share Posted November 21, 2009 I'm thinking something like <?php $total_order_amount = [some type of post or get?]; $order_id = [some type of post or get?]; echo " <img src='https://www.mysite.com/affiliate/sale.php?amount=$total_order_amount&transaction=$order_id' style='visibility: hidden'>"; ?> Explain more if this isn't any help. Try make sure your whole document is in PHP I find it keeps the dynamic approach much more simple. Link to comment https://forums.phpfreaks.com/topic/182347-mysql-variables-in-php-application/#findComment-962275 Share on other sites More sharing options...
baha Posted November 21, 2009 Author Share Posted November 21, 2009 I see... the 'get' will bring the variable's values to the page first... then I should be able to access them in the tracking code... very smart! However, I know nothing about 'get' functions. When you say 'some type of GET', what do you mean? Are there multiple types? I'm certainly willing to try anything. Thanks! Link to comment https://forums.phpfreaks.com/topic/182347-mysql-variables-in-php-application/#findComment-962276 Share on other sites More sharing options...
plznty Posted November 21, 2009 Share Posted November 21, 2009 How do you gather the $total_order_amount etc. Are they on a form page previous to that page you just mentioned where they select? Link to comment https://forums.phpfreaks.com/topic/182347-mysql-variables-in-php-application/#findComment-962280 Share on other sites More sharing options...
baha Posted November 21, 2009 Author Share Posted November 21, 2009 Well, we're putting this code on the 'thank you' page, which is the next page after the customer's order submission. On the order submission page, yes- both variables are used. Link to comment https://forums.phpfreaks.com/topic/182347-mysql-variables-in-php-application/#findComment-962286 Share on other sites More sharing options...
plznty Posted November 21, 2009 Share Posted November 21, 2009 If you where to link me to the URL it may help. Link to comment https://forums.phpfreaks.com/topic/182347-mysql-variables-in-php-application/#findComment-962287 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.