Jump to content

Set values on html page with php


jriggs

Recommended Posts

php beginner here.  I'm working on a registration form that will post some values to a php page, which in turn redirects to a thank you page.  I plan on using javascript to do some basic data validation, but I also will need to connect to a database to re-validate the data.  Suppose the form passes the javascript validation, but fails the db stuff on the php page:

- How would I redirect back to the html page, but automatically populate whatever fields the user has already filled in?  Is there a preferred method to accomplish this?  Thanks for any suggestions-

Link to comment
Share on other sites

Could you not just have php write a quick js script instead of new page if error? i.e:

if(PASSED) { ... }

else { echo('<script type="text/javascript">window.location.history.back();</script>'); }

 

Oor something to that effect. I'm not sure about IE but with FF the browser automatically remembers the form information filled. Hope this helps!

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.