HTML Form: Insert id from related table -
i'm relatively new both php , mysql , here's first question:
i have 3 tables. 1 "main table" , 2 lists/categories of can take , relate them main table. so:
table 1
id name hobby color 1 peter 1 2 2 simon 3 2 3 lisa 2 3
table 2 hobbies
id name 1 swimming 2 football game 3 piano
same table 3 , colors.
id name 1 reddish 2 bluish 3 greenish
now, have managed "relate" tables phpmyadmin, how can following:
i wanna insert info first table. thing is, wanna insert simple number in hobbies or colors. within html form, there should text related is.
so if take 'green'(as string), should insert 3 table 1.
i hope it's clear want :d every help in advance.
simon
create html this:
class="snippet-code-html lang-html prettyprint-override"><select name="color"> <option value="1">red</option> <option value="2">blue</option> </select>
when user select "blue" value of input.color "2". end user selects string/color , can insert int/id
insert
No comments:
Post a Comment