Jump to content

display image onclick of product name


srinivasa

Recommended Posts

i want to display image onclick to productname (attached snapshot and code page) i have verified(throuh console) that image is succesfully uploading but need to popup/show image onclik to product name

 

for ex : if i click on sony (which is product name plz have a look at my snapshot) then show image corresponding to that product name)

here is the database

--

-- Table structure for table `products`

--

CREATE TABLE IF NOT EXISTS `products` (

`product_id` int(11) NOT NULL auto_increment,

`product_name` varchar(150) NOT NULL,

`subcat_id` int(11) NOT NULL,

`price` varchar(20) NOT NULL,

`description` text NOT NULL,

`product_image` varchar(200) NOT NULL,

`uploaded_date` varchar(50) NOT NULL,

PRIMARY KEY (`product_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

 

plz reply

snapshot.htm

product-display.php

Link to comment
Share on other sites

I'd imagine you'd want to do it something like this...

 

First, you'd want to store the URL to the product image in the database. You could do this by adding an extra column for the image URL to the products table (looks like you have already done this), or, if you will have multiple images per product, giving the images their own table (one column would contain the id for the product the URL is associated with, and the second column would contain the URL itself).

 

Your link that pops up the image would include an id of the product: yoururl.com/displayimage.php?id=1.

 

In the displayimage.php page, you would check to see if an id value was set, and make sure it is valid. Then you query the database, get the URL of the image associated with that id, and display it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...