Hi,
I have a restaurant script that uses the below to place the paypal email address for checking out:
define('PAYPAL_EMAIL', 'your@paypal.com');
This is ok as a constant if I was to use the same Paypal email address throughout, but I am going to have multiple restaurants. For each restaurant it has its own details like name, address, tel no, email etc...
The way it calls each restaurant is as follows:
You first select the city, then you select the street, then you select the restaurant, I have found this in the code:
if ($_REQUEST['rid']) {
$rsr=getSqlRow("SELECT id,cityid,streetid FROM rests WHERE id=".remSpecialChars($_REQUEST['rid'])."");
$_SESSION['cityid']=$rsr['cityid'];
$_SESSION['streetid']=$rsr['streetid'];
$_SESSION['restid']=$rsr['id'];
}
I see also that the email is:
$rs['email']
I would like to know, what I need to do so that it calls the email address and uses that for the PayPal Email on each restaurant and not use the constant DEFINE.
Any ideas will be welcomed?
Kind regards,
bigfoot_3000
Currently using DEFINE and need help
Moderator: General Moderators
-
bigfoot_3000
- Forum Newbie
- Posts: 6
- Joined: Tue Jan 26, 2010 6:44 am
Re: Currently using DEFINE and need help
Well, the email address is probably stored with the rest of the restaurant data in the rests table.
"SELECT email FROM rests where id = '$_SESSION[restid]'" ought to do it assuming you actually meant $rsr['email'] and not $rs['email'].
For that matter, if the email address is in the same table, just change the query in the $rsr variable and add the email field.
If the email address is in a different table, you'll have to find out which one and query it. But match it to the $_SESSION['restid'] as in the example above.
I hope this helps.
"SELECT email FROM rests where id = '$_SESSION[restid]'" ought to do it assuming you actually meant $rsr['email'] and not $rs['email'].
For that matter, if the email address is in the same table, just change the query in the $rsr variable and add the email field.
If the email address is in a different table, you'll have to find out which one and query it. But match it to the $_SESSION['restid'] as in the example above.
I hope this helps.
-
bigfoot_3000
- Forum Newbie
- Posts: 6
- Joined: Tue Jan 26, 2010 6:44 am
Re: Currently using DEFINE and need help
Hi JakeJ,
Thanks for your help.
Well, at the moment the only way it is allowing access to a PayPal email is from this command below:
//paypal details
define('PAYPAL_EMAIL', 'your@paypal.com');
define('PAYPAL_BUTTON', '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="'.PAYPAL_EMAIL.'">
<input type="hidden" name="item_name" value="#{order_id} Food Order">
<input type="hidden" name="amount" value="{total_price}">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="button_subtype" value="products">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
<input type="hidden" name="return" value="'.$GLOBALS['mainurl'].'paypal.php">
<input type="hidden" name="cancel_return" value="'.$GLOBALS['mainurl'].'">
</form>');
I need to make it so that it can call the email address of a restaurant and put it where PAYPAL_EMAIL should be.
Regards,
bigfoot_3000
Thanks for your help.
Well, at the moment the only way it is allowing access to a PayPal email is from this command below:
//paypal details
define('PAYPAL_EMAIL', 'your@paypal.com');
define('PAYPAL_BUTTON', '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="'.PAYPAL_EMAIL.'">
<input type="hidden" name="item_name" value="#{order_id} Food Order">
<input type="hidden" name="amount" value="{total_price}">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="button_subtype" value="products">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
<input type="hidden" name="return" value="'.$GLOBALS['mainurl'].'paypal.php">
<input type="hidden" name="cancel_return" value="'.$GLOBALS['mainurl'].'">
</form>');
I need to make it so that it can call the email address of a restaurant and put it where PAYPAL_EMAIL should be.
Regards,
bigfoot_3000
Re: Currently using DEFINE and need help
If it has to pull from paypal, I have no clue. They might give you that info though. You could always collect it in your own local database as it gets passed to you and query from there.