PHP & MYSQL

I am using PHP to write data to a MySQL database. A user should fillout up-to 3 separate forms. How do I save this information in the database in 3 different tables. Is my question clear?

Do I use sessions? Do I use cookies?  Is there another alternative?  

diverdiver.
diverdiverAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
azzkikrConnect With a Mentor Commented:
Hey diverdiver,

If I understood you correctly you are talking about consequently filled forms, a survey in other words.
Usually when one requires a user to fill three consequent forms he will need all three filled out, so there is no point to store each one separately to the database.
On the other hand, storing the data entered in the session object isn't a good idea, because they usually should be kept relatively small, especially on heavily loaded sites, otherwise you'll end up with your server engine consuming too much memory or constantly serializing the session objects. Keeping this data in session may worth it in only rare case when you require disconnected user to continue his survey.
So, I think the best way is to pass the data in the hidden fields. It will require more network traffic from and to client, but it is simple and reliable.

Hope this helps,
Stas
0
 
DImirCCommented:
What do you mean at "A user should fillout up-to 3 separate forms"?
0
 
diverdiverAuthor Commented:
Yes a user most fill out up to 3 forms. I had to separate it into three forms as there is a lot of information that needs to be filled out by the user.

diverdiver.
0
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

 
azzkikrCommented:
So does my comment answer your question then? ;)

Stas
0
 
lokeshvCommented:
if your data is just the text data i dont think Session would affect performence  of your system.

session data is stored in the tmp files on the server and you can store upto 2 mb of data


and in ur case if its just text data then it shld be arnd 2-3 kb.. so shld affect performence at all.



Regards,
Lk
0
 
GEM100Commented:
Pass the data from form to form using INPUT TYPE=HIDDEN, and let the final form insert it all into database(s).
0
All Courses

From novice to tech pro — start learning today.