Page 1 of 2

Load $_SERVER['PHP_SELF'] with rollover image

Posted: Tue Sep 14, 2004 2:18 pm
by ljCharlie
Is there a way to use a rollover menu to do a $_SERVER['PHP_SELF'] and also send along a hidden value that tells me which rollover menu button was click by a user?

Below is my rollover menu button codes generated in Adobe Image Ready.

Code: Select all

<table id="Table_01" width="165" height="35" border="0" cellpadding="0" cellspacing="0">
			<tr>
				<td>
					<img name="galleryMenus_01" src="images/galleryMenus_01.gif" width="165" height="35" border="0" alt="" usemap="#galleryMenus_01_Map"></td>
			</tr>
		</table>
		<map name="galleryMenus_01_Map">
		<area shape="rect" alt="" coords="0,0,86,34" href="#"
			onmouseover="toggleImages('Current', new Array('galleryMenus_01', 'images/galleryMenus_01-Archived_ov.gif'), '', new Array('galleryMenus_01', 'images/galleryMenus_01-Archived-05.gif')); return true;"
			onmouseout="toggleImages('Archived', new Array('galleryMenus_01', 'images/galleryMenus_01-Archived-05.gif'), 'Current', new Array('galleryMenus_01', 'images/galleryMenus_01-Current_-04.gif'), '', new Array('galleryMenus_01', 'images/galleryMenus_01.gif')); return true;"
			onmouseup="selected='Archived'; changeImages('galleryMenus_01', 'images/galleryMenus_01-Archived-05.gif'); return true;">
		<area shape="rect" alt="" coords="78,0,164,34" href="#"
			onmouseover="toggleImages('Archived', new Array('galleryMenus_01', 'images/galleryMenus_01-Current_ove.gif'), '', new Array('galleryMenus_01', 'images/galleryMenus_01-Current_-04.gif')); return true;"
			onmouseout="toggleImages('Archived', new Array('galleryMenus_01', 'images/galleryMenus_01-Archived-05.gif'), 'Current', new Array('galleryMenus_01', 'images/galleryMenus_01-Current_-04.gif'), '', new Array('galleryMenus_01', 'images/galleryMenus_01.gif')); return true;"
			onmouseup="selected='Current'; changeImages('galleryMenus_01', 'images/galleryMenus_01-Current_-04.gif'); return true;">
		</map>


What I'm trying to do is creating a rollover menu buttons or tabs that according to which menu button it was clicked, a table with data from the MySQL database will show up on that same page.

Any help is gratefuly.

ljCharlie

Posted: Tue Sep 14, 2004 2:23 pm
by ljCharlie
Or herhaps anyone can show me how to use a hyper link that will send a value showing which button it was clicked.

ljCharlie

Posted: Tue Sep 14, 2004 2:25 pm
by feyd
why not just have a link for them to click?

imagemaps are passe. ;)

Posted: Tue Sep 14, 2004 2:39 pm
by ljCharlie
Yes, I thought of that...but I want to have menu tabs. I wonder if that is possible.

Thanks for your response.

ljCharlie

Posted: Tue Sep 14, 2004 2:41 pm
by feyd
you don't need image maps to have menu tabs. You don't need image maps ever anymore.. (pretty much)

Posted: Tue Sep 14, 2004 2:41 pm
by ljCharlie
I have tried this:

<area shape="rect" alt="" coords="0,0,86,34" href=\"<?PHP echo $self?mnuArchived="Archived"\ ?>"

But it's not working. Maybe I'm missing something.

ljCharlie

Posted: Tue Sep 14, 2004 2:42 pm
by feyd
that'd be quotes you're missing. :P

Posted: Tue Sep 14, 2004 2:46 pm
by ljCharlie
Will you show me what quotes I'm missing?

Thanks!

ljCharlie

Posted: Tue Sep 14, 2004 2:48 pm
by feyd

Code: Select all

<area shape="rect" alt="" coords="0,0,86,34" href="<?PHP echo "{$_SERVER['SCRIPT_NAME']}?mnuArchived=Archived" ?>" />
similar to that.

Posted: Tue Sep 14, 2004 2:54 pm
by ljCharlie
It works; however, there is a slight problem. The menu button don't stay selected anymore. When clicked on the menu button, the page does refresh and I believed it also pass a line a variable too but the buton no longer stay on a selected state.

Any idea on how to fix this?

ljCharlie

Posted: Tue Sep 14, 2004 2:56 pm
by ljCharlie
And by the way, instead of href do you think it's possible to implement a onClick() with the same function....meaing refresh the page and also pass along a variable?

ljCharlie

Posted: Tue Sep 14, 2004 2:56 pm
by feyd
make the image used dynamic based on the current value of the variable(s) .. make sure to have processing for default (no variable) too.

Posted: Tue Sep 14, 2004 3:00 pm
by ljCharlie
Sorry for asking a lot of questions but, what do you mean by making the miage use dynamic base? And how do I do that? Quick example is appreciated.

ljCharlie

Posted: Tue Sep 14, 2004 3:04 pm
by feyd

Code: Select all

<?php

$var = isset($_GET['mnuArchive']) ? $_GET['mnuArchive'] : '';

switch($var)
{
case 'Archived':
  $image = 'archived.jpg';
  break;

case 'Foo':
  $image = 'something_else.jpg';
  break;

default:
  $image = 'default.jpg';
  break;
}

echo '<img src="' . $image . '" usemap="#whatever" />';

?>

Posted: Tue Sep 14, 2004 3:20 pm
by ljCharlie
So by having a the image using a dynamic base that should solve the problem of the button not on selected state, right?

ljCharlie