I have been given a problem by the BOSS !!!Please help this prat get off my back.The problem is as follows:-
I need to design a drop down form that can select multiple options via the control key that will then go an query a Mysql database with the results that where selected by the form.
And then bring back the required data from the database into a webpage.
The type of data in the form would be .
Firstname
Lastname
ID
Age
Therefore if Firstname and Lastname where selected I would need some sort of If ,else or switch (case) statement that would be able to tell me if those option where selected and then go and query the database for the desired information.
Now I have tried a few different methods as a test before implementing the connection and querying code in php so that I could just test wheather the form could recognise that two or more options have been selected and then print out a different message for each possible combination.
Below is some script that I tried
<FORM TARGET="<?php echo $PHP_SELF; ?>" METHOD=POST>
<select name="test" Multiple >
<option value ="Firstname">Firstname</option>
<option value ="Lastname">Lastname</option>
</form>
</select>
<input type="submit" />
yet a if statement like this would not work
if ($test =="Firstname") AND ($test =="Lastname") {
print ('both selected');
}
Please could someone point me in the right direction with an easier method to achieve the desired results and hence learn something new as I am learning php and mysql .
Additional info that may be important , I have reg globals turned off therefore i am declaring the variables , Version of php is 4.xx and latest stable buid of mysql.
Thanks in advance to anyone that can help, and I hope that I can help others in the future and share the knowledge
Cheers
Antony