Jump to content

Code "Back" button to retain values from $_POST


karthikjayraj

Recommended Posts

Hi,

 

 

I have set up 2 php pages

 

page 1 - add_entry2.php

In this page I have a invoice table created where I can dynamically add/delete rows. This has a View Bill button which takes me to page 2- add_entry3.php

In this page it shows up the rows added in page 1 in read only format, so if the user wants to modify the data that he/she entered then he must Click on <back> that i have provided in the page 2 which will direct him to page 1

 

Now the problem starts here

on click of Back the dynamically added rows dissappear..which is frustrating..I know its something to do with my code..but can anyone help me fix it.

 

One more thing is that i dont want to store the data into DB till the finalise button is clicked on page 2 so that means till page 2 is submitted nothing goes to DB from Page 1. 

 

 

I am able to retain values if I use the code

<form action="add_entry2.php" name="eval_edit" method="post" format="html">

 

i,e if I submit back to the same page and retrieve values form $_POST

 

 

but If I use the code

<input type="button" value="Back" onClick="history.go(-1);return true;">

to get back to add_entry2.ph it looses all the values. Is there any other way to code the BACK link retaining my $_POST values(Do you think $_SESSION would work in this case?)

 

 

 

The best way to do this would be to code your Back Button to the form post page and make it another form... post those fields as <input type="hidden" name="fieldname" value="posted_value" /> then post the submitted values back to the form and populate the fields based on the original information submitted.

 

IE sucks - and this is one reason why - many of us PHP developers wish IE was never created...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.