View Full Version : Pulling Data In A Popup
scottdog129a
06-26-2009, 02:25 PM
I have a site that I'm wanting to sell goods on. On a particular page, I want a user to be able to click on a "purchase" link and have a popup show with a form to fill out that gets sent to me via email (Im going to be using PayPal for the processing). The url for each item is different because the last digit is the unit number of the item.
Here is an example: http://www.sthompsonphoto.com/index.php?showimage=17
How can I add "17" to a field in the form when the pop-up happens? Any ideas?
Thank you very much in advance!
Scott T.
legersolutions
06-26-2009, 02:36 PM
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
<!--
function changeURL(n)
{
window.open("http://www.sthompsonphoto.com/index.php?showimage=" + n);
}
//-->
</script>
</head>
<a href="javascript:changeURL(1)">1</a> <a href="javascript:changeURL(2)">2</a> <a href="javascript:changeURL(3)">3</a>
</body>
</html>
:)
scottdog129a
06-26-2009, 03:28 PM
Im a tad on the confused side. Would this be the code for the popup or the code for the page that I sent you? Sorry. :(
OH! I see now what you've done. But, all I need is this:
You make your way to http://www.sthompsonphoto.com/index.php?showimage=17 and decide you want to buy it. You click on "purchase" and a popup shows up with a form containing fields for your name, email, address, AND a field for the item number. I want that item number to be pulled from the URL, in this case "17".
OR, can you, instead of the URL, pull a word from the actual site? Or in the HTML?
Hope that makes more sense. Sorry if I didnt explain it correctly! :)
legersolutions
06-27-2009, 05:08 AM
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
<!--
function changeURL(n)
{
window.open("http://www.sthompsonphoto.com/index.php?showimage=" + n);
}
function getQuerystring(key, default_)
{
if (default_==null) default_="";
key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
var qs = regex.exec(window.location.href);
if(qs == null)
return default_;
else
return qs[1];
}
function showParameters()
{
alert(getQuerystring('showimage'));
}
//-->
</script>
</head>
<body onload="showParameters()">
<a href="javascript:changeURL(1)">1</a> <a href="javascript:changeURL(2)">2</a> <a href="javascript:changeURL(3)">3</a>
</body>
</html>
Hope this will help u...
:)
scottdog129a
06-29-2009, 11:00 AM
Thanks for the post, but its giving me a Javascript error when I test it. Also, there is no popup. It just goes to my website.
scottdog129a
06-29-2009, 12:44 PM
Actually, it might be easier to just pull the picture name off the site. I think there is a tag in the HTML that is named <IMAGE_NAME>. Can THAT be used to fill in the image name field in the form that pops up?
coothead
06-29-2009, 12:51 PM
Hi there Scott,
check out the attachment, starting at "brief notes". ;)
scottdog129a
06-29-2009, 01:34 PM
This is AMAZING!! Thank you! IS there a possible way to use the image name? The only reason that I ask is because when you first go to the site, the URL doesnt show a number. Also, it might be a little easier down the road.
coothead
06-29-2009, 01:51 PM
Hi there Scott,
no problem, here is the revision...
scottdog129a
06-29-2009, 02:05 PM
Hey coot. Thank you so much, but its just displaying the image FILE name, not the actual name. Is this even possible? The photoblog software Im using uses the tag <IMAGE_NAME> to display the image on my site. Can this be used?
coothead
06-29-2009, 02:08 PM
Hi there Scott,
just in case you meant that you don't want the "link_to_index.html", then use this...
coothead
06-29-2009, 02:22 PM
Hi there Scott,
..its just displaying the image FILE name, not the actual name
You are moving the goal posts again. :eek:
We started with a simple...
"17"
...then moved on to...
"20090623164710_pic17.jpg"
...and now you want some...
"IMAGE_NAME". :lol:
Where, actually, in the "index.php" do we find this...
"IMAGE_NAME". :confused:
scottdog129a
06-29-2009, 02:29 PM
Im so sorry for being a pain. I apologize. Im not much of a php person, but Im guessing its around line 474 of the php file. I could be wrong and most likely am.
You can view the file that I change to change the site here:
http://www.sthompsonphoto.com/templates/horizon/image_template.html
And its <IMAGE_TITLE>, not <IMAGE_NAME>. My bad.
Thank you SO VERY MUCH for your help! :)
coothead
06-29-2009, 03:26 PM
Hi there Scott,
Right, I see that you require the title attribute of the image to be sent to the form. :agree:
This, again presents no problem. :disagree:
Note:-
IE will display "Coffee House Street" the others "Coffee%20House%20Street". ;)
scottdog129a
06-29-2009, 04:16 PM
Coothead, I swear I owe you big time! Thank you so very much for ALL your help! :)
coothead
06-29-2009, 04:25 PM
revision_2 nailed it then. :lol:
scottdog129a
07-01-2009, 07:28 PM
Hey, Coot, is there a way to control the size of the popup? I want to add some stuff to it and make it wider. Ideas?
coothead
07-02-2009, 01:36 AM
Hi there Scott,
that is very easy for you to do. :agree:
Just open the get_title.js file in Notepad and edit the value in this line...
var features='width=500,height=400,left=200,top=200,scrollbars=1'
scottdog129a
07-02-2009, 10:55 AM
Thank you so much!
scottdog129a
07-02-2009, 12:08 PM
This drives me nuts! What am I doing wrong to where these two divs arent side by side? So frustrating...
http://www.sthompsonphoto.com/purchase.html?Spider%20Plant
scottdog129a
07-02-2009, 02:33 PM
Nevermind! Got it! :)
coothead
07-02-2009, 03:27 PM
Hi there Scott,
now that you have got it working OK, maybe you should consider making provisions for those who have javascript disabled . :agree:
The "INFO / PURCHASE / 5 COMMENTS" link will be dead and you may loose potential customers if you do not add some
alternative options or a suggestion to enable javascript for a visit to your site. :eek:
All you need to do is make a page and pop it in here...
<a href="#" onclick="Effect.toggle('image-info','BLIND'); return false;">Info / Purchase / 5 Comments</a>
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.