9 9 Votes

PHP/MySQL: How to store dynamic field's values in Database

Question by Guest | 26/08/2014 at 17:25

I have a form with some static and some dynamic fields:

<form action="script.php" method="post">

// static Fields
<input type="textbox" name="classname" /> 
<select name="gender" />
  <option value="Male">Male</option>
  <option value="Female">Female</option>
</select>

// dynamic Fields
<input type="textbox" name="seatno[]" />
<input type="checkbox" name="type[]" />
<input type="checkbox" name="type[]" />
<input type="checkbox" name="type[]" />
<input type="radio" name="lave[]" />
<input type="radio" name="lave[]" />
<select name="class[]" />
  <option value="A">A</option>
  <option value="B">B</option>
  <option value="C">C</option>
  <option value="D">D</option>
</select>

</form>

My database table view is:

id - Class Name - Gender - Seat No  - Type - Lave - Class Type
1  - Upper A    - Male   - 575      - GRA  - A1   - Alete A
1  - Upper A    - Male   - 575      - GRA  - A1   - Alete A
1  - Upper A    - Male   - 575      - GRA  - A1   - Alete A
2  - Upper B    - FeMale - 02       - GRA  - A1   - Alete B
2  - Upper B    - FeMale - 271      - GRA  - A1   - Alete B
2  - Upper B    - FeMale - 25       - GRA  - A1   - Alete B

How can I insert this form data using PHP in my MySQL database?

Moderations Note: We had to rewrite this question, because it was very confusing. Please give some more information (as a comment, we will add it), so that we can answer your question. How are the dynamic fields created? Are they always the same or are there differences? Because it seems as if your columns are always the same, because your table view seems to be static?! So, what is the "dynamic"-part in your question?

ReplyPositiveNegative

Related Topics

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.

Participate

Ask your own question or write your own articles on askingbox.com. How to do.