Entry
How can I, in PHP, list the possible values of a MySql enum field?
Jan 17th, 2003 00:20
Pierre Nissels, Eve Atley,
Try something similar to this:
<INPUT TYPE=radio NAME="refunded" VALUE="y" <?if($row[refunded]=='y')
echo "CHECKED";?>>Yes
<INPUT TYPE=radio NAME="refunded" VALUE="n" <?if($row[refunded]=='n')
echo "CHECKED";?>>No
My question was more tricky. I want a php script that will find out
itself about the possible values of a given enum field in the MySQL
database and will dynamically echo as many "<input...>" fields in the
form as needed. There is no knowledge at design time of the possible
values of the enum field. They have to be queried at run time. But how?
Something like a foreach loop stepping through the enum values
collection and echoing the needed form field.