Click to See Complete Forum and Search --> : Dynamic popup windows,mysql,php,javascript


Ljdonice
03-22-2003, 11:59 AM
I wish to include pop up windows on my website to include additional product information,Im usind a mysql database and php. I have downloaded a popup window maker program. I have got the pop up window to work, but im wondering how i go about making the information it contains, to be Dynamic as i have about 8,000 products that i want to display info about.
Any help int his matter would be most appreciated.
Thanks
John

Ljdonice
03-23-2003, 01:05 PM
Originally posted by Dave Clark
Generally, you would do that like this:

<a href="productinfo.php?id=456789" target="myWin" onclick="
var winPtr = window.open('', this.target, 'features');
return true;">456789</a>

Using the above arrangement, your popups will continue to work even if JavaScript is disabled.

Dave

Hi Dave
Firstly I would like to thank you for responding to my problem, it realy is appreciated.

This is what i have at the moment...............I have been told to put this into the head section of my page!

<script language="JavaScript" type="text/javascript">
<!--
function PopWindow()
{
window.open('http://www.textual-intercourse.co.uk/order.php','order','width=450,height=350,menubar=no,scrollbars=no,toolbar=no,location=no,directories =no,resizable=no,top=0,left=0');
}
//-->
</script>

and this into the body section..........
<a href="JavaScript:PopWindow()">Open Window</a>

Question, Where do i use your code, and do i need to change the code i have in the head section?
also i have created a page called productinfo.php to try this out, do i use your code as is or do i need to change anything?

as before any help would be appreciated as this is my first website... also i am more than happy to pay for any help.

Many thanks
John

Ljdonice
03-23-2003, 02:05 PM
Originally posted by Dave Clark
If you use this script:

<script language="JavaScript" type="text/javascript">
<!--//
function PopWindow(url, win)
{
var ptr = window.open(url, win,
'width=450,height=350,top=0,left=0');
return false;
}
//-->
</script>

and this link:

<a href="http://www.textual-intercourse.co.uk/order. php" target="order"
onclick="return PopWindow(this.href, this.target);">Open Window</a>

you'll get the benefits of which I spoke.

Dave

Hi Dave

Ok i have replaced my code with the code above and i have the popup windows working but im back to my original problem. I have changed order.php to productinfo.php
Is my problem with productinfo.php, I cant see how to get the information into the popup window.

Many thanks
John

Ljdonice
03-24-2003, 11:31 AM
Originally posted by Dave Clark
That just requires a change to the link:

<a href="http://www.textual-intercourse.co.uk/order. php?id=34567" target="order"
onclick="return PopWindow(this.href, this.target);">Open Window</a>

The output from your PHP code is targeted for the popup window. All it has to do is take the product id from the query string and output the associated product information in the normal fashion.

Dave

Hi Dave, thanks for that!

I have this at the moment

<a href="http://www.textual-intercourse.co.uk/productinfo.php?id=<?php echo $row_Recordset1['id']; ?>" target="order"
onclick="return PopWindow(this.href, this.target);">Open Window</a>

Were making progress cause now i have the correct id name coming up in the browser bar, but i have 30 links per page,each with its own id number, when i click on a link the productinfo window is opening, but it always includes the first id number on the page. Im wondering if im missing something in my productinfo.php page!!

Many thanks

John

Ljdonice
03-24-2003, 12:35 PM
Originally posted by Ljdonice
Hi Dave, thanks for that!

I have this at the moment

<a href="http://www.textual-intercourse.co.uk/productinfo.php?id=<?php echo $row_Recordset1['id']; ?>" target="order"
onclick="return PopWindow(this.href, this.target);">Open Window</a>

Were making progress cause now i have the correct id name coming up in the browser bar, but i have 30 links per page,each with its own id number, when i click on a link the productinfo window is opening, but it always includes the first id number on the page. Im wondering if im missing something in my productinfo.php page!!

Many thanks

John

Hi Dave
Further to my last posting, ive playing around with my productinfo.php page, and i think weve cracked it.
I'll get back later
Many Many Thanks
John

Ljdonice
03-24-2003, 02:52 PM
Originally posted by Ljdonice
Hi Dave
Further to my last posting, ive playing around with my productinfo.php page, and i think weve cracked it.
I'll get back later
Many Many Thanks
John

Hi Dave

Dave you are a genius, I cant tell you how grateful i am for helping me. I now have dynamic popup windows and can get on with the rest of my website.

One more thing, is it possible to remove the url from displaying in the browser bar and say something like "preview"
its not important,

<a href="http://www.textual-intercourse.co.uk/productinfo.php?id=<?php echo $row_Recordset1['id']; ?>" target="order"
onclick="return PopWindow(this.href, this.target);">Open Window</a>

Many thanks
John

Ljdonice
03-25-2003, 03:41 AM
Originally posted by Dave Clark
No, but you should not be getting an addressbar showing if you left this part:

'width=450,height=350,top=0,left=0'

in your function.

Dave

Hi Dave

Sorry, i was refering to the bottom bar on my main website page, when i move the mouse pointer over the popup window link it displays the following.

http://www.textual-intercourse.co.uk/processorder.php?id=12345

I just thought it would be nice to hide some of it.

Many thanks
John

Ljdonice
03-25-2003, 11:28 AM
Originally posted by Dave Clark
Oh, you can do that like this:

<a href="whatever" onmouseover="
window.status='Have a nice day.';
return true;" onmouseout="
window.status='';
return true;">link text</a>

Dave

Hi Dave
Okay,got that working. Once again thanks very much for your help.
I'll let you know when my sites finished, then maybe you could take a look.

Many thanks
John