简体   繁体   中英

Make all hyperlinks on a PHP page, post a form end then redirect

The short version of what I am looking to do is make a "safe" and idiot-proof page, at least as much as possible.

I have researching the best way to make every hyperlink on a page (ie. standard menus used on the page or any other hyperlinks outside of a HTML form) submit/POST the form information and then redirect to the page clicked on.

For some reason not all users remember the "Save" button before clicking on something else. Then they are upset because they didn't save their information. I would much rather have all the information be saved before sending them on to the hyperlink's URL.

Helpful information: - This is on a PHP based project. - I have already put in place code to "detect" what kind of page is in use and if the feature is needed. - I have header() redirects in some places for other items, so that is nothing new. - I have looked at javascripts to add, when needed, so that the form is POSTed, and found some options for that.

At this point I can't get the final steps put together, such as a javascript that would POST the information AND store the URL that the hyperlink was supposed to go to. Process the POST information and then redirect to the stored URL.

Dream Example:

onclick="submitformandforward("Example_form", "http://example.mysite.com/example_page.php?querystring=Y")"

Any suggestions, tips, examples, etc are warmly welcomed!

Thanks.

KH

Javascript is the tool you require...

remember some people may have it switched off...

Wehn some clicks a link - check that the form values have been altered - if not carry on - if they have inform that that changes need saving...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM