PHP/MySQL: How to store dynamic field's values in Database
Question by Guest | 2014-08-26 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?
Related Topics
Send Form Input as an Array to PHP Script
Tip | 0 Comments
MySQL: Line Breaks in MySQL
Tip | 0 Comments
How to Replace multiple Texts at the same Time
Tutorial | 0 Comments
HTML: Preassign HTML Form with Data
Tutorial | 0 Comments
How to resize Image before Upload in Browser
Tutorial | 13 Comments
HTML5: Upload Images with Client Side Resize
Tutorial | 9 Comments
Send HTML5 Canvas as Image to Server
Tutorial | 0 Comments
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 article on askingbox.com. That’s how it’s done.