Create a Function from a button
Posted: Wed Apr 07, 2004 4:49 pm
Hello All
Thank you for allowing me to post to your forum.
I have a button that I need to turn into a function. here is the code that works for the button followed by the function code which is not setting the values for the button. Can anyone see what I may be doing wrong here? Thanks
Working 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=<? 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>
Function code NOT working:
<?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";
}
?>
Any insight would be GREAT! Thanks.
NYColt
Thank you for allowing me to post to your forum.
I have a button that I need to turn into a function. here is the code that works for the button followed by the function code which is not setting the values for the button. Can anyone see what I may be doing wrong here? Thanks
Working 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=<? 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>
Function code NOT working:
<?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";
}
?>
Any insight would be GREAT! Thanks.
NYColt