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?)

 

 

 

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.