Connecting Tech Pros Worldwide Forums | Help | Site Map

Can php form data be saved into a MySQL database?

Newbie
 
Join Date: Feb 2007
Posts: 5
#1: Feb 27 '07
I've tried to find a decent guide online as to how to do this, but all I run into is software.

Basically I have a form that once submitted, produces calculations on the output page based on inputs.

I want to have it give users a # after they submit it, that will let them recall the data they submitted for future review. Is this a possibility? If so, can anyone provide a good guide? Thanks :)

Ex, User inputs data, hits submit, is sent to output page, and provided with a unique number (i.e. 2033) Next day, user wants to look at the output again, so he inputs the #2033 in a box on the main page, hits submit, and the data is retrieved from the database.

Familiar Sight
 
Join Date: Nov 2006
Posts: 161
#2: Feb 27 '07

re: Can php form data be saved into a MySQL database?


Well I presume that part of the output page would contain php code to INSERT the submitted values and calculations and unique value into the mysql table. The output page would give the user his number: 2033.

Then the next day he comes back and types 2033 into the text box of another page you have. But that page, when submitted, does a SELECT from the mysql table. Along the lines of "select * from your_table where unique_number = '$unique_number' " (Of course $unique_number = $_POST['unique_number'].) And then that will output his data in whatever format you decide.

That should work...
Reply