Going back to previous page

My project has customers create an order, submit and save the order to mysql database. I want to then be able to have the customer go back to the NewOrder page but have some of the same fields and data automatically filled in to save them from re-entering all the data.

This is the basic page flow. User creates an order. Completes the form with their customer’s name, the order date and the required date. Another field is for the for item code and quantity required. The EditParts button will take them to a page where they can edit the parts the item is made from. The User checks the parts break up and submits the order. Parts get saved to the database. User then wants to add more items to the order and goes back to the NewOrder page.
At the moment the page loads with blank fields and the User then re-completes the form. Not the most ideal set up.

If anyone can give me an idea how I can do this, that would be perfect.

cracker

I have an ordering system that allows users to create orders and change and edit the items in the form before submitting to the database. Once submitted, the user can then go back to order form and create another item. The problem that I am trying to solve is when you go back to the blank order form the fields are auto filled from the previous order. At the moment the form fields are all blank and the user has to re-enter all the data again.

Hope someone can help me out.

Thanks…cracker

Hello,

do you want the form to have the previous entered values or no just blank form?

I didnt quite understand

I think he wants the previous values inputted, in which case why not pull the last row from the database and have them set as the value for the form. If you have user accounts that should not be a problem otherwise just log their IP along with their order so you you can you the WHERE clause in your sql query.

Or Better yet he can use super global arrays, those datas are still there.

[php]
//With POST
<input type=‘text’ name=‘fname’ value=’<?php echo @$_POST['fname'];?>’>

//With GET
<input type=‘text’ name=‘fname’ value=’<?php echo @$_GET['fname'];?>’>
[/php]

that would input the last inputted value by the user.

Cheers.

Thanks wilson,
I’ll give that a try. Not sure exactly where that code snippet should go though. Is it on the page where I have the form? So if the user logs in and loads the page the first time, values in the form should be blank since nothing gets passed in by the $_POST? And then once the user creates an order and enters some fields and then goes back to the order form the last values entered are automatically filled in?
The reason I need it to be auto filled is that I am trying to save the user re-entering some of the information.eg the order date, the customer name etc. At the moment the user fills in the fields, date, their customer name, an order number and item code, submts the order to the database and then want to add some more items to the order so they go back to the order form page but have to re-enter all the same info up to the item code section…
Appreciate you thoughts.
cracker

So if the user logs in and loads the page the first time, values in the form should be blank since nothing gets passed in by the $_POST? And then once the user creates an order and enters some fields and then goes back to the order form the last values entered are automatically filled in?

Correct.

Not sure exactly where that code snippet should go though. Is it on the page where I have the form?

go to your form and for every textbox that you have add this value=’<?php echo @$_POST['fname'];?>’

be sure to change [i]fn to the corresponding textbox name.x name.

Sponsor our Newsletter | Privacy Policy | Terms of Service