Is it possible??

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
iant
Forum Newbie
Posts: 4
Joined: Sun Aug 09, 2009 5:59 am

Is it possible??

Post by iant »

Hi,

I have been learning PHP for the last month and have hit a problem, I need to insert a PHP form into a PHP script.

PHP Script "Form in here" shows where i need to insert the code.

Code: Select all

$out.="<a rel=\"lightbox[".$gal."]\" title=\"$file\" href=\"$gal/$file\" paypalform=\"FORM IN HERE\">";
$out.="<img src=\"thumbs/".createThumb( $gal."/".$file, "thumbs/", $width )."\" width=\"$width\" alt=\"".$file."\" class=\"bordered\" /></a>\n";
PayPal Code to be inserted

Code: Select all

<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="email@email.com">
<input type="hidden" name="lc" value="GB">
<input type="hidden" name="item_name" value="Pictures">
<input type="hidden" name="item_number" value="999">
<input type="hidden" name="button_subtype" value="products">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="add" value="1">
<input type="hidden" name="bn" value="PP-ShopCartBF:btn_cart_SM.gif:NonHostedGuest">
<table>
<tr><td><input type="hidden" name="on0" value="Sizes">Sizes</td></tr><tr><td><select name="os0">
    <option value="Small">Small £0.99</option>
    <option value="Medium">Medium £1.99</option>
    <option value="Small">Small £2.99</option>
</select> </td></tr>
</table>
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="option_select0" value="Small">
<input type="hidden" name="option_amount0" value="0.99">
<input type="hidden" name="option_select1" value="Medium">
<input type="hidden" name="option_amount1" value="1.99">
<input type="hidden" name="option_select2" value="Small">
<input type="hidden" name="option_amount2" value="2.99">
<input type="hidden" name="option_index" value="0">
<input type="image" src="https://www.paypal.com/en_GB/i/btn/btn_cart_SM.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">
</form>
Is it possible? and could anyone give me some pointers?

Many Thanks
Ian
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Post by Jonah Bron »

You are trying to put an entire form into a fictitious attribute? Why?
iant
Forum Newbie
Posts: 4
Joined: Sun Aug 09, 2009 5:59 am

Re: Is it possible??

Post by iant »

Hi,

Thanks for your reply.

The script is built into a CMS site which displays galleries with LightBox, The additional "paypalform" is displayed on the bottom of the lightbox window for customers to purchase the picture.

It works prefectly if i paste the html code into the cms, but i want it to add it automatically.

Is there a better way to do it??
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Is it possible??

Post by AbraCadaver »

Save the form in a file called 'paypalform.html', then include it:

Code: Select all

// is this something you just made up on your own?  If so, get rid of it.
$out.="<a rel=\"lightbox[".$gal."]\" title=\"$file\" href=\"$gal/$file\" paypalform=\"FORM IN HERE\">";
//
$out.="<img src=\"thumbs/".createThumb( $gal."/".$file, "thumbs/", $width )."\" width=\"$width\" alt=\"".$file."\" class=\"bordered\" /></a>\n";
include 'paypalform.html';
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Post Reply