Jump to content

Archived

This topic is now archived and is closed to further replies.

skatermike21988

Useing An Image As A Link Then If statement for that image

Recommended Posts

ok i have a shout box on my main page. i want to have an image at the top saying shout box and when clicked will echo the shout box and another to say member info that when clicked will display users member info or if not logged in echo not logged in etc.

how would i do this?

Share this post


Link to post
Share on other sites
[!--quoteo(post=356869:date=Mar 21 2006, 06:09 AM:name=Skater Mike)--][div class=\'quotetop\']QUOTE(Skater Mike @ Mar 21 2006, 06:09 AM) [snapback]356869[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Any Help Anyone?
[/quote]

you could make a link from the image which re-calls the page with a URL parameter that, when detected, shows the relevent details, using $_GET

or you could preload the info within a hidden table/div tag and use javascript to reveal it when the image is clicked.

Share this post


Link to post
Share on other sites
[!--quoteo(post=356892:date=Mar 21 2006, 03:46 AM:name=redbullmarky)--][div class=\'quotetop\']QUOTE(redbullmarky @ Mar 21 2006, 03:46 AM) [snapback]356892[/snapback][/div][div class=\'quotemain\'][!--quotec--]
you could make a link from the image which re-calls the page with a URL parameter that, when detected, shows the relevent details, using $_GET

or you could preload the info within a hidden table/div tag and use javascript to reveal it when the image is clicked.
[/quote]
Could You Give Me An Example Code For That???

Share this post


Link to post
Share on other sites
[!--quoteo(post=357533:date=Mar 23 2006, 10:00 AM:name=Skater Mike)--][div class=\'quotetop\']QUOTE(Skater Mike @ Mar 23 2006, 10:00 AM) [snapback]357533[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Could You Give Me An Example Code For That???
[/quote]

without knowing exactly how you have things set up, it'd be awkward to do the code for you. but for example:

[code]
<?php
if (isset($_GET['foo']))
{
   echo 'foo is '.$_GET['foo'];
}
?>

<a href="<?php echo $_SERVER['PHP_SELF'];?>?foo=bar"<img src="myimage.jpg" /></a>
[/code]

if you clicked the image, it would reload the current page with ?foo=bar in your URL, which you can then get at with $_GET['foo']

as for javascript, that's a different story and one for the javascript forum, but basically you load all the info you need into a table with the CSS style 'display:none', and when the image is clicked (using onClick) it sets the CSS style of the table so that it shows.

Share this post


Link to post
Share on other sites

×

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.