I have a mysql table where the columns are id, name, username and password.
I have it working so that names are in the dropdown, its its posting it, but is there a way to make it display the name, yet post the id? The following is what I have done, it works, but the id is just a number and means nothing to the user. When I trade that out for name, the user is able to read and understand it, but some of the names have spaces, punctuation ect, and I would like to have it to be able to look up the username and password once the main table is to be updated.
$sql = "SELECT * FROM stud ORDER BY studName";
$result = mysql_query($sql);
echo "<td> <select name='id'>";
while ($row = mysql_fetch_array($result)) {
echo "<option style='text-transform: uppercase;'" . $row['id'] . "'id='dropdown' >" . $row['id'] . "</option>";
}
echo "</select></td></tr>";
echo "<tr><td><input id='submit' name='submit' type='submit' value='Submit'></td></tr></table> </form>";
basically what I want is this but I can't get this to work.
$sql = "SELECT * FROM stud ORDER BY studName";
$result = mysql_query($sql);
echo "<td> <select name='id'>";
while ($row = mysql_fetch_array($result)) {
echo "<option style='text-transform: uppercase;'" . $row['id'] . "'id='dropdown' >" . $row['name'] . "</option>";
}
echo "</select></td></tr>";
echo "<tr><td><input id='submit' name='submit' type='submit' value='Submit'></td></tr></table> </form>";