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
https://forums.phpfreaks.com/topic/123781-set-values-on-html-page-with-php/
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!

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.