I have a db with all the staff details on. I have my webpage that displays all this data but i want to be able to have buttons like "all", "directors" etc that when clicked on will only show that dept
Whats the best way to do this
Regards
Dan
I have a db with all the staff details on. I have my webpage that displays all this data but i want to be able to have buttons like "all", "directors" etc that when clicked on will only show that dept
Whats the best way to do this
Regards
Dan
First you will need an action to occur when a button has been clicked. If the html element had a value of 'directors' then you could do something like this:
$staff=$_POST['directors'];
if(isset($staff))
{
$sql_query = mysql_query("select * from tablename where fieldname='$staff'") or die (mysql_error());
while ($result = mysql_fetch_assoc($sql_query))
{
echo $result['fieldname'] ."<br>";
}
}
Then do the same thing for different options eg admin, managers, students
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.