Zeroshade Posted December 10, 2006 Share Posted December 10, 2006 Is it possible to say if this link is clicked then something happens? if so, how can i say the if this link is clicked because i know what will happen ^_^? Quote Link to comment Share on other sites More sharing options...
fert Posted December 10, 2006 Share Posted December 10, 2006 you mean like<a href="page.php?link=1">Click[/url]page.php[code]if($_GET['link']==1){echo "you clicked on link one";}[/code] Quote Link to comment Share on other sites More sharing options...
Zeroshade Posted December 10, 2006 Author Share Posted December 10, 2006 Not exactly but if it points to the an html file then would it still work? Quote Link to comment Share on other sites More sharing options...
fert Posted December 10, 2006 Share Posted December 10, 2006 what do you mean 'if it points to an HTML file'? Quote Link to comment Share on other sites More sharing options...
Zeroshade Posted December 10, 2006 Author Share Posted December 10, 2006 This is my goal. I want a picture to be displayed. If the picture is clicked then the first picture will equal the second picture which then equals a whole new picture and therefore displays the new picture instead. So basically I want a slideshow. Can I do this? Quote Link to comment Share on other sites More sharing options...
Zeroshade Posted December 10, 2006 Author Share Posted December 10, 2006 Can this be adapted somehow?[code]<?php $picture = "images\blue-carry.jpg"; echo "<a href='images\blue-carry.jpg?link=1'><img src='$picture' /></a>"; if($_GET['link']==1) { $picture = "images\blue-ebook.jpg"; echo "<img src='$picture' />"; } ?>[/code] Quote Link to comment Share on other sites More sharing options...
trq Posted December 10, 2006 Share Posted December 10, 2006 [quote]Can this be adapted somehow?[/quote]No.. that code makes little sense.Explain exactly what it is you want to do, or if its a simple slideshow even better, search for a tutorial. Quote Link to comment Share on other sites More sharing options...
Zeroshade Posted December 10, 2006 Author Share Posted December 10, 2006 if the picture is clicked then the $picture will equal another picture and then show that instead. Any ideas? Quote Link to comment Share on other sites More sharing options...
phil.t Posted December 10, 2006 Share Posted December 10, 2006 I would recommend that you store the image paths in a numbered array, and increment through them one by one as the images are clicked.Here's an example:[code]<?php$photos = array (1=>'img/photo_1.jpg', 'img/photo_2.jpg', 'img/photo_3.jpg', 'img/photo_4.jpg');$curPic = $_GET['id'] + 1;if ($curPic < 5) echo '<a href="slideshow.php?id=' . $curPic . '"><img src="' . $photos[$curPic] . '" /></a>';else echo '<p>End of Show</p>';?>[/code]The id displayed in the URL will be one behind the index of the picture actually being displayed. If that bothers you, then you can modify where you actually increment your index value. In case it isn't obvious, replace 'slideshow.php' with whatever you name your php file. Quote Link to comment Share on other sites More sharing options...
Zeroshade Posted December 11, 2006 Author Share Posted December 11, 2006 what has to be in the php file? Quote Link to comment Share on other sites More sharing options...
Zeroshade Posted December 11, 2006 Author Share Posted December 11, 2006 oh, u mean keep this out of the html and make an external with this in it. ok. Quote Link to comment Share on other sites More sharing options...
Zeroshade Posted December 11, 2006 Author Share Posted December 11, 2006 I'm not understanding the link. If i point it to the slideshow.php then it opens up a new page. if i take it out like so... it'll refresh the page with the new picture. How can i keep it from acutally refreshing?[code]<?php $picture = array (1 => 'images\blue-carry.jpg', 'images\blue-ebook.jpg'); $curPic = $_GET['id'] + 1; if ($curPic < 3) echo '<a href="?id='.$curPic.'"><img src="'.$picture[$curPic].'" /></a>'; else echo '<p />End of Show'; ?>[/code] Quote Link to comment Share on other sites More sharing options...
trq Posted December 11, 2006 Share Posted December 11, 2006 [quote]How can i keep it from acutally refreshing?[/quote]You cant. A request needs to be made to the server and the server needs to send the response. Of course you could use some Ajax trickery but thats a whole other beast not really in the scope of this forum. Quote Link to comment Share on other sites More sharing options...
Zeroshade Posted December 11, 2006 Author Share Posted December 11, 2006 i think as long as i keep the pics closer to the top of the page then the users wouldn't notice it refresh... thank u all for ur help! 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.