Jump to content

A popup Window?


rameshfaj

Recommended Posts

I have a database with entries like:itemid,itemname,itempicture,itemstock,...etc.

 

I have displayed the itemid,itempicture on the PHP pages.

Now what i want is that when the user clicks on the image of the item,the other informations about the item(selected from the database )should be displayed in the popup window.

 

I am using PHP for the serverside scripting and Mysql for the database server.Any help,codes are appreciated.

Link to comment
Share on other sites

Since this is in the AJAX section of the forum - I'll answer your question with a Javascript solution...however this doesn't have much to do with AJAX itself....

 

Browsing the web for a simple window.open example, I came across this:

<script type="text/javascript">
function openwindow() {
    window.open("http://www.javascript-coder.com","mywindow","menubar=1,resizable=1,width=350,height=250");
}
</script>
<p>
<a href="javascript: openwindow()">Open the JavaScript Window Example 1</a>
</p>

 

All you have to do is take your current product variables, and create a name/pair string that will be appended to your url in the window.open method.

<?php

echo('<script type="text/javascript">
function openwindow(getProperties) {
    window.open("http://www.mydomain.com/?"+getProperties,"mywindow","menubar=1,resizable=1,width=350,height=250");
}
</script>
');

$stringAppend = "";
// let's say you had two variables...$prodName and $prodDescription....
$stringAppend .= "prodName=" .$prodName. "&prodDesc=" .$prodDescription;
// so now your $stringAppend looks like..."prodName=Chicken&prodDesc=this_is_chicken"....

echo('
<p>
<a href="javascript: openwindow(' .$stringAppend. ')">Open the JavaScript Window Example 1</a>
</p>
');

?>

 

So when you call your openwindow javascript function, your url will look like...http://www.mydomain.com/?prodName=Chicken&prodDesc=this_is_chicken

 

Hope this helps!

 

Link to comment
Share on other sites

That was only the window,but what i wanted is the popupwindow as you find in the many popular sites.Display the window in the same page.

I have posted a picture of the yahoo home page.Here the content section:Create one now- it's fast and easy!..is displayed on the popup window.

 

[attachment deleted by admin]

Link to comment
Share on other sites

I have a database with entries like:itemid,itemname,itempicture,itemstock,...etc.

 

I have displayed the itemid,itempicture on the PHP pages.

Now what i want is that when the user clicks on the image of the item,the other informations about the item(selected from the database )should be displayed in the popup window.

 

I am using PHP for the serverside scripting and Mysql for the database server.Any help,codes are appreciated.

 

I don't see the relationship between your first post and the image you provided...the image you provided doesn't show anything related to 'additional information.

 

In your popup window, you can pass it GET variables that show the product ID...and in your php code you can just do an SQL query and supply the WHERE clause with the product id.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.