0

Dear All,

I'm going to put some submenus into tabs and put its contents there. i want to fetch the name of the tab (menu) from the database. for this case, i must use looping 'while'.

for example

<body>
<?php
$query=mysql_query("SELECT * FROM modul WHERE ket='submenu_mahasiswa'");
$result=mysql_fetch_array($query);
?>
<div id="tabs">
<?php while($result){ ?>
	<ul>
		<li><a href="#tabs-1">$result['nama_modul']</a></li>
	</ul>
	<?php } ?>

	<div id="tabs-1">Content 1 Here! (I can put anything here, form etc..)

The problem --> id of each tab must be different based on the menu link(<a href="#tabs-1">). how can i make that since i use looping and fetching data from database???

Hope i make my question clear..thank you :)

2
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by smantscheff
0

You sure have a unique id field in the modul table which you could use to form an anchor, like in <a href="#tabs-$result['id']">$result['nama_modul']</a> Apart from that, the php code tags are missing in line 9.

0

Thanks for the reply smantscheff,ya the id is unique
i'll try that..but, what about the tab content itself? guess, i must type the div id of tab manually so when the tab hit, the content is there.

0

No, i think i can generate the content. i'll try for more..

Thanks a lot smantscheff. that's a lot of help :))

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.