Jump to content

Recommended Posts

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............

 

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...

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.