[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

PHP & MYSQL

Posted on 2002-07-29
6
Medium Priority
?
286 Views
Last Modified: 2006-11-17
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.
0
Comment
Question by:diverdiver
6 Comments
 

Expert Comment

by:DImirC
ID: 7187040
What do you mean at "A user should fillout up-to 3 separate forms"?
0
 
LVL 1

Accepted Solution

by:
azzkikr earned 600 total points
ID: 7187648
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
 

Author Comment

by:diverdiver
ID: 7187967
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:azzkikr
ID: 7188074
So does my comment answer your question then? ;)

Stas
0
 
LVL 4

Expert Comment

by:lokeshv
ID: 7188223
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
 
LVL 8

Expert Comment

by:GEM100
ID: 7201168
Pass the data from form to form using INPUT TYPE=HIDDEN, and let the final form insert it all into database(s).
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses
Course of the Month18 days, 4 hours left to enroll

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question