Linking menu item with a text

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Linksminas
Forum Newbie
Posts: 1
Joined: Tue Mar 20, 2007 3:02 pm

Linking menu item with a text

Post by Linksminas »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi there

I just started learning PHP.

I have created dynamic menu - items in menu are listed from table where I keep those items.

Now I have a problem how to link each menu item with a text it has tu show in main body once I click that item. I read on the internet about onClick event and realized that their should be some workaround. But no luck so far.

Here is my index.php Don't laugh please

Code: Select all

<body>
<?php
$mysqli = new mysqli('localhost','root','*****');
$mysqli->select_db('web');
?>
<table class="main" width="750" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="115" colspan="2"><img src="_web_pictures/baneriz.jpg" width="750" height="115"></td>
  </tr>
  <tr>
    <td width="177" height="800">
	<table class="top" border="0" cellpadding="0" cellspacing="0" >
	<?php
	$result = $mysqli->query("select m_name from menu order by eile");
	
	for ($i=1; $i <= mysqli_num_rows($result); $i=$i+1)
	{
		$row = $result->fetch_array(MYSQLI_ASSOC);
		echo "<tr><td class='meniu_mouse_off' onmouseover=\"this.className='meniu_mouse_on'\" onmouseout=\"this.className='meniu_mouse_off'\" [u]onclick=\"\"[/u] width='177' height='30' align='center'><p class='lower'><font face='verdana'><b>"; // <----
		echo $row["m_name"];
		echo "</p></b></font></tr></td>";
	}
	?>
	</table>
	</td>
    <td width="633" height="800"><font class="body">[b]Mamamia[/b]</font>
	</td>
  </tr>
</table>
<?php
$mysqli->close();
?>
</body>
I bolded the echo thay gives me a headache and underlinded the place where I am stuck.

I want text to appear where word 'Mamamia' is (bolded).

Thank you for your help in advance! Any comments ant suggestions are welcome! Links too.[/u][/b]


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Post by califdon »

It would really help if you state clearly what you want to do and what isn't working now. Remarks like "this is where it gives me a headache" and "where I am stuck" don't give us any idea what is wrong. Tell us exactly what is supposed to happen and what does or doesn't actually happen.
Post Reply