Jump to content
Sign in to follow this  
Ben_Waldman

"remember" Form

Recommended Posts

Hello all,

 

Please bare with me as I try to explain my issue with very weak terminology. Well, I'm using Dreamweaver to create a database that uses PHP & MySQL. Currently, I'm working on a page that inserts user entered data from a form into my database. Upon clicking insert, MySQL will reject the data if a field is null, not in correct format, etc. So, when the user returns to the previous page to correct the error all the information previously entered is now gone.

 

I'm not quite sure what to use so that the user entered information will be "remembered". I was thinking Javascript, but really couldn't find anything. Does Dreamweaver have something I can use? Possibly a cookie? I really have no idea and that is why I'm asking for help. If someone could even provide me with the correct terminology so I could do further research that would be very helpful. Thanks!

 

Ben

Share this post


Link to post
Share on other sites

What version of Dreamweaver are you using, CS3?

If so you can use the Spry widgets for form validation. This will prevent the form from processing until all field requirements are met, eliminating any need to go back.

Share this post


Link to post
Share on other sites

You might try this:

 

><a href='java script:history.go(-1)' onmouseover='self.status=document.referrer;return true'>Return to Form</a>

Share this post


Link to post
Share on other sites

if you are posting to the same page then why not use the $_POST array to repopulate the fields

 

 

i.e.

 

><form action="thispage.php" method="post">

<input type="text" name="whatever" value="<?php echo (isset($_POST['whatever']) ? $_POST['whatever'] : ''); ?>" />

<input type="submit" name="insert" value="Insert" />
</form>

 

 

This will repopulate the 'whatever' field with the value that was entered before the user clicked 'Insert' and it will leave the fields blank when the form is loaded for the first time (i.e. when the post array is empty)

 

 

edit: sorry if this is an old thread i replied then saw the date.

Edited by OJB

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×