Forms

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Forms

Post by tim »

Is there any code I can enter that will save the data in the input fields?

I have a <form action=verify.php etc etc

and on verify.php I have a ton of validation terms, with a
click <a href='javascript:history.go(-1)'>here</a> to go back

and when it does, the fields are blank, how do i get it to save the data?

cheers
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

I am not sure.. but i think you are asking the impossible here.

Atleast as long as you calling ti with the java............................go(-1)
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

well JS or not, is there a way?

a header(cache?????

I googled but came up with empty hands. even if I use a:
<a href=page.php>Click here to go back and fill in the requierd fields</a> deal it does not save the data
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Try header("Cache-control: private");
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

If you're using sessions, its cake!

Code: Select all

<input type="text" name =name <?php if(isset($_SESSION['name'])) echo "value="$_SESSION[name]"";?> >
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

markl999 wrote:Try header("Cache-control: private");
Sorry mark, that dont work either (as I was fiddling with header information)

malcomb - I didnt really want to assign each input field a session variable JUST to get this effect. I was hoping there would be an alternate way

anymore ideas?
User avatar
MarK (CZ)
Forum Contributor
Posts: 239
Joined: Tue Apr 13, 2004 12:51 am
Location: Prague (CZ) / Vienna (A)
Contact:

Post by MarK (CZ) »

Well, when you submit a form, you push a lot of data with it, right? So, just make a link backwards but with all the data (e.g. whole $_GET array) attached to it as part of URL.

Then in the form will just be:

Code: Select all

<INPUT TYPE="text" NAME="textField1" VALUE="<?= textField1 ?>">
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

Update - the top of my page has the following code

Code: Select all

<?
header("Cache-control: private");
session_start();
?>
This gave no errors - I changed the order knowing the session_start should be first.

it works, BUT if I use the <a href=page.php>click me to go back</a> the information is lost. However, the back button as well as the JS (see oldpr0, you was wrong :wink:) works liek a charm

excellent, thanks mark (shooter) & everyone!!!!!!
Post Reply