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 :)

Recommended Answers

All 5 Replies

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.

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.

Why can't you generate the tab content from the database?

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

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

Please mark this thread as solved - if it is.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.