View Full Version : PHP Photo Album script v2.11 with hidden form variable declaration for PayPal

06-10-2010, 02:59 AM
1) Script Title: PHP Photo Album script v2.11 with hidden form variable declaration - A lot of views, not one response?

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/php-photoalbum.htm

3) Describe problem: :confused:

Okay, I am not strong in javascript. I taught myself php pretty well, but javascript has too many repeat variable names and un-obvious functions for me to grasp it.

Having said that, I am trying to use the lightbox style feature on the PHP PhotoAlbum and use a PayPal button with it. I edited the "footer" <div> code to include a PayPal button, and I need a hidden field that has the value of that particular picture that has been expanded, so that when the customer hits the "Buy Now" button, it of course carries over the particular item number (the picture name- ie: 01.jpg) to PayPal, so I know which product to send them. I'm going to attach the segment of code I am referring to as well as the website url I am talking about. It's probably extremely eaasy for someone with common javascript sense, and if it were a php thing, I would have no problem, but I don't get it. I will try to color code it some it makes easy to read sense.

From the ddphpalbum.js file, line 128 - OF course you can see I added a lot to it, and the stuff in PINK Is all good.

definefooter: '<div class="footerbar"><form action="https://www.paypal.com/cgi-bin/webscr" method="post"><input type="hidden" name="cmd" value="_s-xclick"><input type="hidden" name="hosted_button_id" value="XXXXXXXXXXXXX"><input type="hidden" name="on0" value="Sizes"><font color="white">Sizes</font><select name="os0"><option value="16&quot; x 20&quot;">16&quot; x 20&quot; $29.99</option><option value="12&quot; x 16&quot;">12&quot; x 16&quot; $24.99</option><option value="8.5&quot; x 11&quot;">8.5&quot; x 11&quot; $21.99</option></select><input type="hidden" name="on1" value="Enter Artwork ID"><input type="hidden" name="os1" maxlength="60" value= "??" ></td></tr></table><input type="hidden" name="currency_code" value="USD">&nbsp; &nbsp; &nbsp; &nbsp;<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_buynow_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">&nbsp; &nbsp; &nbsp; &nbsp; <a onClick="thumbnailviewer.closeit()"><font color="white">CLOSE X</font></a></form></div>', //Define HTML for footer interface

If you're familiar with this script, I could really use your help on this. I thank anyone in advance.

06-11-2010, 12:32 AM
Did I do something wrong? Noone is respnding to my post at all, tho many have looked and I know that it's a simple fix for anyone that knows javascript (as I don't). Any advise on how one can get their post answered?

06-11-2010, 07:32 AM
This isn't a dedicated help line, have some patience. Besides, this tends to require at least a passing understanding of PayPal. I mean, you could probably solve it without that, but it definitely helps. And you must know the script at least a little too.

Anyways, the form you have is OK just like it is, though I might change it a little. You want to set the value of os1 when the user clicks on a thumbnail so that it's set when and if they click the buy now button. You can do that here:

new phpimagealbum({
albumvar: myvacation, //ID of photo album to display (based on getpics.php?id=xxx)
dimensions: [22,1],
sortby: ["file", "asc"], //["file" or "date", "asc" or "desc"]
showsourceorder: true, //Show source order of each picture? (helpful during set up stage)
onphotoclick:function(thumbref, thumbindex, thumbfilename){
thumbnailviewer.loadimage(thumbref.src, "fit2screen")

Like so:

onphotoclick:function(thumbref, thumbindex, thumbfilename){
document.getElementsByName('os1')[0].value = thumbfilename;
thumbnailviewer.loadimage(thumbref.src, "fit2screen")

06-11-2010, 11:12 AM
It was that simple. You're a gentleman, and a scholar, thank you so much!