rameshfaj Posted March 5, 2007 Share Posted March 5, 2007 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. Quote Link to comment Share on other sites More sharing options...
JakeTheSnake3.0 Posted March 8, 2007 Share Posted March 8, 2007 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! Quote Link to comment Share on other sites More sharing options...
rameshfaj Posted March 12, 2007 Author Share Posted March 12, 2007 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] Quote Link to comment Share on other sites More sharing options...
JakeTheSnake3.0 Posted March 12, 2007 Share Posted March 12, 2007 That is NOT a pop-up window...that's just a div that's been either created by javascript, or simply made visible by either javascript or css hover states. Quote Link to comment Share on other sites More sharing options...
rameshfaj Posted March 14, 2007 Author Share Posted March 14, 2007 But what I wanted is the popup window for the same problem. Quote Link to comment Share on other sites More sharing options...
JakeTheSnake3.0 Posted March 14, 2007 Share Posted March 14, 2007 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.