Logiciel Pro Logiciel Pro - 2 years ago 123
MySQL Question

drop down list check data in phpmyadmin and chose the real option

My problem is that I have this dropdown list:

<form method="post">
<label for="user">what is the capital of france:</label>
<select id="user" name="user">
<option>new york</option>
<input type="submit" value="Submit" class="button">

I want to make one of the options
, like "What is the capital of Paris?" If someone chose
I want show
and if someone chose
I want to show
and redirect to another page.

How to do this with phpMyAdmin because I am workin in localhost. My PHP version is 5.

Answer Source

First you need to add value to option tags like this

       <option value="rabat">rabat</option>
       <option value="newyork">new york</option>
       <option value="paris">paris</option>

Or whatever value you want, you can just add 1,2,3 for values and in the backend code where you check the post and implement the logic behind it, if the value user selected is value "paris" or value 3 or whatever you put there, if it is just do the redirect, if not do your code logic (e.g. write out pop-up message saying the answer is wrong)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download