NEWBIE NEEDS HELP! Save data from PHP form in 2 separate sessions?

Hi! I have created a basic php feedback form with 20 fields. However, instead of sending an empty form for my client to fill, I want to pre determine some of the fields first. So basically, the php code should allow me to fill some of the fields first and then the submit button should send a link of a partially filled form to the client. The client will then complete the form and click submit, which will save data from all the fields back to the database. Can anyone help me on how this can be done? I am kind of stumped as I am new to php and both MySQL select and $_Get variable don’t seem to do the trick. Thanks.

Welcome to the SP forums.

Let me start by saying there’s no such thing as a PHP form. You have a PHP script that creates a HTML/CSS/Javascript) page, and that page in your case contains a form. That page is then sent by the server to the client (the user’s browser).
It’s not the submit button that sends the form to the client, the submit button is part of the form in the HTML page, and the user clicks on it to send the (filled in) form back to the server.

You can’t use the $_GET variable to prefill the form, because until the user sends the form back to the server (assuming you use method=“get” in your form) there will be no form values in there. You most probably will get your starting values from the database, so all you have to do is put them at the right places in the form.

If it’s still not clear, please post the code you’ve got so far and surely we’ll be able to point you in the right direction.

Hi Guido,

Thanks so much for the response. I do understand what you are saying. Let us now say that I have two clients, one is me and one is my actual client, as in the user I need to take feedback from. But before I send him the form, I need to fill out some details myself so that he knows what project he is giving his feedback on. So I have this fully functional form which saves all the data back to the database. What I wanna do is fill the first few fields myself and then submit the form which will send my data to the database. In addition, there should be an email sent to MY CLIENT (User providing feedback) with a link to the partially filled form which he completes and submit again to the database. His entries are added to my data in the same tuple in one of the database’s table. Please guide me as to how this can be done. Seems very complex. I have some ideas. Maybe isset() can be used or maybe I need to make 2 separate HTML forms both saving their data to the same database, with one of the fields common to both of them, so that one record is coherent. Sorry for being so lengthy. Do you still need to take a look at my code?

So what you want your client to do is modify the data you’ve stored in the database.
Send your client a mail with a link to the ‘modify data’ script, with the id that identifies the record in your database.
Something like:

modify.php will use that id to retrieve the data from the database and fill in the form.

Something like that. But not really modify the data that I’ve entered, just fill the fields that were left empty. Ok sounds good, but I have no clue what I need to write in the modify.php and how to add the id that identifies the record, Please note that all I should be doing is filling in the form (an initial form or a part of the actual form) and then the php file should do the selection of the record and then generating the link of the partially filled form and then sending it via email. What methods am I supposed to use?

Depends on what you leave blank.

Step 1: Create form.
Step 2: Link form to database.
Step 3: When form is submitted, IF not all fields are filled in, send email with link to modify.php (or whatever you call it.)
Step 4: When client/manager/whatever clicks on link (#1 i suggest here you implement some form of login logic, if you want security on this form), load form data from database
Step 5: Display form again, with only missing fields editable.
Step 6: Step 2 repeated.