Posted on 2002-07-29
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?  

Question by:diverdiver

Expert Comment

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

Accepted Solution

azzkikr earned 150 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,

Author Comment

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.

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.


Expert Comment

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


Expert Comment

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.


Expert Comment

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

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Dynamic varibles 5 33
How would I do a website like this? 5 57
maybe no no httpd.conf 6 47
PHP PDO   How do I correctly remove record using DELETE FROM? 1 20
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

778 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