Current location: Hot Scripts Forums » Programming Languages » PHP » Adding a Hyper Link to a PHP Thumbnail Pic


Adding a Hyper Link to a PHP Thumbnail Pic

Reply
  #1 (permalink)  
Old 04-06-06, 07:26 PM
kpowers4 kpowers4 is offline
Newbie Coder
 
Join Date: Mar 2006
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Adding a Hyper Link to a PHP Thumbnail Pic

I need help adding Hyper Links to my PHP (array generated) Thumbnail Pictures. Id like the link to reference a file of the same picture that is just bigger, the hyper link should open up another window.

Any help or tips would be helpfull!!

Here is the php code the displays the pictures from my MySQL database:

PHP Code:

for($i=$n_start;$i<=$n_end;$i++)

 { 
    echo 
"<tr>";
    echo 
"<td align='center'>
                 
{$products[$i]['catalog_number']}</td>\n";
    echo 
"<td>{$products[$i]['description']}</td>\n";
    echo 
"<td>\${$products[$i]['price']} </td>\n";
    echo 
"<td><img src='images/{$products[$i]['pix']}'></td> \n"
    echo 
"</tr>";
 } 

Last edited by Christian; 04-06-06 at 08:52 PM. Reason: Please use [PHP][/PHP] when posting php code!
Reply With Quote
  #2 (permalink)  
Old 04-06-06, 08:20 PM
mab's Avatar
mab mab is offline
Community VIP
 
Join Date: Oct 2005
Location: Denver, Co. USA
Posts: 2,674
Thanks: 0
Thanked 0 Times in 0 Posts
Changing this line -
PHP Code:

echo "<td><img src='images/{$products[$i]['pix']}'></td>\n"
To this -
PHP Code:

echo "<td><a target='_blank' href='bigimages/{$products[$i]['pix']}'><img src='images/{$products[$i]['pix']}'></a></td>\n"
should work. The above assumes that your big image files are located in a directory called bigimages (where as your thumbnail images are in a directory called images.)
__________________
Error checking, error reporting, and error recovery. If your code does not have these to get it to tell you why it is not working, what makes you think someone in a programming forum will be able to tell you why it is not working???
Reply With Quote
  #3 (permalink)  
Old 04-07-06, 08:51 AM
kpowers4 kpowers4 is offline
Newbie Coder
 
Join Date: Mar 2006
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
WOW!!

That's great!! Thank you very much!!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Six Sites Exchanging Links! - PR3+ Web Hosting, Web Design, Entertainment & Career coffeecoder General Advertisements 0 10-10-05 12:52 AM
Xml / Dom / Css Mark_SC.SE JavaScript 0 06-29-05 08:05 AM
PHP multi-dimensional array sorting issue aqw PHP 2 06-24-05 11:09 PM
PHP Link Crackboy PHP 1 03-09-05 11:04 AM
PHP script to change URL link weekly hculbert Script Requests 0 01-23-04 03:48 PM


All times are GMT -5. The time now is 07:07 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.