I'm new to php and mysql and I'm trying to learn how to store the following array data from three different arrays friend[], hair_type[], hair_color[] using MySQL and PHP an example would be nice. Thanks
Here is the HTML code.
<input type="text" name="friend[]" id="friend[]" />
<select id="hair_type[]" name="hair_type[]">
<option value="Hair Type" selected="selected">Hair Type</option>
<option value="Straight">Straight</option>
<option value="Curly">Curly</option>
<option value="Wavey">Wavey</option>
<option value="Bald">Bald</option>
</select>
<select id="hair_color[]" name="hair_color[]">
<option value="Hair Color" selected="selected">Hair Color</option>
<option value="Brown">Brown</option>
<option value="Black">Black</option>
<option value="Red">Red</option>
<option value="Blonde">Blonde</option>
</select>
<input type="text" name="friend[]" id="friend[]" />
<select id="hair_type[]" name="hair_type[]">
<option value="Hair Type" selected="selected">Hair Type</option>
<option value="Straight">Straight</option>
<option value="Curly">Curly</option>
<option value="Wavey">Wavey</option>
<option value="Bald">Bald</option>
</select>
<select id="hair_color[]" name="hair_color[]">
<option value="Hair Color" selected="selected">Hair Color</option>
<option value="Brown">Brown</option>
<option value="Black">Black</option>
<option value="Red">Red</option>
<option value="Blonde">Blonde</option>
</select>
Here is the MySQL tables below.
CREATE TABLE friends_hair (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
hair_id INT UNSIGNED NOT NULL,
user_id INT UNSIGNED NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE hair_types (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
friend TEXT NOT NULL,
hair_type TEXT NOT NULL,
hair_color TEXT NOT NULL,
PRIMARY KEY (id)
);