Page 2 of 3
Posted: Wed Apr 07, 2004 7:55 pm
by NYColt
Hmmm not quite, but it DID call the values just not with in the button it placed the vales nex to the button see here
http://buysellandsearch.com/listingview ... istingID=4
I think that is getting closer!
Posted: Wed Apr 07, 2004 7:57 pm
by NYColt
I need the email address, ItemID which is puppies and the price which is 1500.00 they are all called but just not within the button.
Posted: Wed Apr 07, 2004 8:32 pm
by feyd
Okay, seeing what your stuff it outputing, those functions are definitely echoing. Here's what to do, replace this:
Code: Select all
<?php
function renderpaypal() {
echo "<form action="https://www.paypal.com/cgi-bin/webscr" method="post">\n";
echo "<input type="hidden" name="cmd" value="_xclick" />\n";
echo "<input type="hidden" name="business" value="" . renderSingleListingItemRaw($listingID, "email") . "" />\n";
echo "<input type="hidden" name="item_name" value="" . renderSingleListingItemRaw($listingID, "item_name") . "" />\n";
echo "<input type="hidden" name="amount" value="" . renderSingleListingItemRaw($listingID, "amount") . "" />\n";
echo "<input type="hidden" name="return" value="http://www.mysite.com" />\n";
echo "<input type="hidden" name="notify_url" value="http://www.mysite.com" />\n";
echo "<input type="image" src="https://www.paypal.com/images/x-click-but23.gif" name="submit" />\n";
echo "</form>\n";
}
renderpaypal(); // Now we are calling it ..
?>
with:
Code: Select all
<?php
function renderpaypal() {
$listingID = $GLOBALS['listingID'];
echo '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">\n';
echo '<input type="hidden" name="cmd" value="_xclick" />\n';
echo '<input type="hidden" name="business" value="';
renderSingleListingItemRaw($listingID, "email");
echo '" />\n';
echo '<input type="hidden" name="item_name" value="';
renderSingleListingItemRaw($listingID, "item_name");
echo '" />\n';
echo '<input type="hidden" name="amount" value="';
renderSingleListingItemRaw($listingID, "amount");
echo '" />\n';
echo '<input type="hidden" name="return" value="http://www.mysite.com" />\n';
echo '<input type="hidden" name="notify_url" value="http://www.mysite.com" />\n';
echo '<input type="image" src="https://www.paypal.com/images/x-click-but23.gif" name="submit" />\n';
echo '</form>\n';
}
renderpaypal(); // Now we are calling it ..
?>
or:
Code: Select all
<?php
function renderpaypal() {
$listingID = $GLOBALS['listingID'];
?>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">\n;
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="<? renderSingleListingItemRaw($listingID, "email"); ?>" />
<input type="hidden" name="item_name" value="<? renderSingleListingItemRaw($listingID, "item_name"); ?>" />
<input type="hidden" name="amount" value="<? renderSingleListingItemRaw($listingID, "amount"); ?>" />
<input type="hidden" name="return" value="http://www.mysite.com" />
<input type="hidden" name="notify_url" value="http://www.mysite.com" />
<input type="image" src="https://www.paypal.com/images/x-click-but23.gif" name="submit" />
</form>
<?
}
renderpaypal(); // Now we are calling it ..
?>
there are a few more ways to do it, but that gets it done.
Posted: Wed Apr 07, 2004 8:45 pm
by NYColt
BEAUTIFUL!

Put there are a bunch of \n \n all around it ?
Posted: Wed Apr 07, 2004 8:51 pm
by feyd
just remove the \n's from the php then.. I guess.
Posted: Wed Apr 07, 2004 9:03 pm
by NYColt
Whoa! Thats perfect! Just what I needed. Thank you sooo much for the help man I've been messin with this ALL Day! I really appreciate it!
Thanks.
NYColt
Next thing I need to do is create an "if" statement for the item_name field. if the item_name is empty I don't want the button to show. if the item_name field is Full then I want the button to appear. That is what I need to do right? I mean an if statement is what I need right? is there something better or something easier that you know of?
Hey THANKS AGAIN! Goin to BED
Have a Good one!
Posted: Thu Apr 08, 2004 2:39 pm
by ol4pr0
Yes
Edit: To late way to late lol..........
Posted: Fri Apr 09, 2004 11:46 am
by NYColt
I was wondering if you could take a look at this and give me an idea as to how far off I am.
<?php
if (renderSingleListingItemRaw ($listingID, "paypalseller" = "yes")
{
renderpaypal();
}
?>
In case I am sooo far off that you can't tell what I want to do here, I am trying to call the function renderpaypal(); with an if statement
if paypalseller = yes
Any help would be GREAT!
Thanks
NYColt
Posted: Fri Apr 09, 2004 2:57 pm
by feyd
okay. well, the way you wrote that code, you'll get an error of unexpected {.
Where is the paypalseller variable stored?
Posted: Fri Apr 09, 2004 3:12 pm
by NYColt
Database
Posted: Fri Apr 09, 2004 3:12 pm
by NYColt
I will have to do a Query right?
Posted: Fri Apr 09, 2004 3:16 pm
by feyd
you'll have to do a query somewhere along the line to get that variable, so yeah.
Posted: Fri Apr 09, 2004 4:14 pm
by NYColt
Would I do that within the function itself? Would I add something like this to the function or can I do it seperate from the function?
$listingID = make_db_extra_safe($listingID);
$sql = "SELECT ID, field_name FROM " . "default_listingsDBElements WHERE (paypaluser);
if ($listingID, "paypalseller" = "yes")
{
renderpaypal();
}
feyd wrote:you'll have to do a query somewhere along the line to get that variable, so yeah.
Posted: Fri Apr 09, 2004 4:21 pm
by feyd
if you want it done for each instance of renderpaypal() do it in the function. If it's just for this instance, then do it outside.
Posted: Fri Apr 09, 2004 4:35 pm
by NYColt
I would want it done for each instance.
Is my code way off in my last post?
feyd wrote:if you want it done for each instance of renderpaypal() do it in the function. If it's just for this instance, then do it outside.