How to do insert a number of fields into a table from a form a user fills out?

Using php here and mysql

Example. User fills out a survey build form and wants 6 questions. Then clicks next. It now shows 6 blank fill out questions for the user to fill out. Once he is done he clicks finish. From there it creates the table and the fields based on the number of questions. So 6 questions equal 6 fields.

so how do you dynamically build fields in a new table based on the user input from a form?