I did some coding and took quite a bit of time before figuring out part 1-that is loading the data from the database into the drop down.
Now the problem.
The services table has one field only and has about 20 records.
Everytime it loads a new record, it increases I by 1 causing the option value to be increased by 1 too. At one go, it will load all 20 records into the drop down menu.
The code:
<?php
$i=1;
$db = mysql_connect("localhost", "", "");
mysql_select_db("Honeyd",$db);
$result = mysql_query("SELECT * FROM Services",$db);
if ($myrow = mysql_fetch_array($result)) {
echo "Getting Services\n";
echo "<select name='set'>";
do {
echo "<option value='$i'>";
echo $myrow["Service"];
echo "</option>";
$i++;
} while ($myrow = mysql_fetch_array($result));
echo "</select>";
} else {
echo "Sorry, no records were found!";
}
?>
So, after loading it, the user will select what service he/she wants.
Eg
in menu 1 qqqqqqqqq
2 aaaaaaaaa
3 wwwwwww
..........................until 20
##the numbers are the -option value
input/text box - test
Say, the user sees and selects aaaaaaaa. Now, I want to combine "test (from input/text box) aaaaaaaa" then only insert (test aaaaaaaa) into a d/b as a record. My question is: How can the form know which service was selected by the user and then use the selected service to combine with test?
In summary: I as the programmer want to know is-that the user selected that service so I can use the value and combine it.
I am really confused about this part.
I hope you get what I am trying to say here.
Hope someone can help. Really cracked my head thinking about this problem.
Thanks