Logiciel Pro Logiciel Pro - 6 months ago 30
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">
<fieldset>
<label for="user">what is the capital of france:</label>
<select id="user" name="user">
<option>rabat</option>
<option>new york</option>
<option>paris</option>
</select>
<input type="submit" value="Submit" class="button">
</fieldset>
</form>


I want to make one of the options
true
, like "What is the capital of Paris?" If someone chose
rabat
I want show
false
and if someone chose
paris
I want to show
true
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