Hi guys, I hope some1 can help me with this.
I will write down a simplified version of my problem.
I have 2 SQL tables:
Cats, with ID, Name
Dogs, with ID, Name
--> this is simplified, I need them in 2 different tables.
I need the user to select either one cat or one dog, so I thought about using a select form with optgroups. Something like this:
<select name="catsndogs">
<optgroup label="Cats">
<option >Tiger</option>
<option>Leopard</option>
<option>Lynx</option>
</optgroup>
<optgroup label="Dogs">
<option>Grey Wolf</option>
<option>Red Fox</option>
<option>Fennec</option>
</optgroup>
</select>
The user will submit this form and I would retrieve the var in $_POST['catsndogs'].
The problem is, I need to add that value to the DB and if it is either a dog or cat,
ie. :
insert into table values ('cats', 'tiger')
or:
insert into table values ('dogs', 'tiger')
Looking up for the name in the tables after submition is not an option.
Any suggestions on retrieving the "dogs" / "cats" values from the above form ?
English is my 2nd language, so Im sorry about my mispellings,
TIA
P.F.S.