spacerman Posted June 13, 2011 Share Posted June 13, 2011 My idea is to hava a database with movie genres to pick from a dropdown(this works). And when genre is chosen a list of movies of that genre will show up in my table. Here is the code for the dropdown that works... $host="localhost"; // Host name $username="xxx"; // Mysql username $password="xxx"; // Mysql password $db_name="per_film"; // Database name $tbl_name="sjanger"; // Table name $sql="SELECT id, Alle FROM sjanger ORDER BY Alle"; $result=mysql_query($sql); $options=""; while ($row=mysql_fetch_array($result)) { $id=$row["id"]; $sjanger=$row["Alle"]; $options.="<OPTION VALUE=\"$id\">".$sjanger.'</option>'; } ?> <form = method="post"> <SELECT NAME='filmer' onchange="document.getElementById('ex').innerHTML = this.value;" > <OPTION VALUE=0>Alle <?=$options?> </SELECT> </form> Now the problem is to use the dropdown inuput to get results back and put into table.... Can anyone help me with this............ Quote Link to comment https://forums.phpfreaks.com/topic/239219-how-to-fetch-from-mysql-and-use-output-in-table/ Share on other sites More sharing options...
monkeytooth Posted June 13, 2011 Share Posted June 13, 2011 I'm not 100% sure I understand exactly what your tryin to do here. Well I do, but the approach your code seems to imply is confusing me. What results from where when how do you want them? Quote Link to comment https://forums.phpfreaks.com/topic/239219-how-to-fetch-from-mysql-and-use-output-in-table/#findComment-1229033 Share on other sites More sharing options...
spacerman Posted June 13, 2011 Author Share Posted June 13, 2011 Ok. I'll try to explain better. I have a database that holds movie genres(sjanger). I have a dropdown menu connected to that database. I want the user to choose a genre from the dropdown menu, and a list of movies in that genre is shown in a table. As default the list should show all movies. This was supposed to be as easy as possible- just an inventory of my movies. So my main question is: when someone make a choise from the dropdown, how do I show the movies in the list when that genre is chosen? Appreciate your help... Quote Link to comment https://forums.phpfreaks.com/topic/239219-how-to-fetch-from-mysql-and-use-output-in-table/#findComment-1229051 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.