简体   繁体   English

在PHP页面上创建所有超链接,结束表单,然后重定向

[英]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. 我正在研究使页面上的每个超链接(即,页面上使用的标准菜单或HTML表单外的任何其他超链接)提交/发布表单信息,然后重定向到所单击页面的最佳方法。

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. 我宁愿在将所有信息发送到超链接的URL之前保存所有信息。

Helpful information: - This is on a PHP based project. 有用的信息:-这是基于PHP的项目。 - 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. -在某些地方,我可以使用header()重定向其他项,所以这并不是什么新鲜事。 - I have looked at javascripts to add, when needed, so that the form is POSTed, and found some options for that. -我查看了需要添加的javascript,以便将表单过帐,并为此找到了一些选项。

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. 此时,我无法完成最后的步骤,例如将发布信息并存储超链接应该到达的URL的javascript。 Process the POST information and then redirect to the stored URL. 处理POST信息,然后重定向到存储的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 H

Javascript is the tool you require... Javascript是您需要的工具...

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... 某些人单击链接-检查表单值是否已更改-如果未继续-如果他们已告知需要保存更改...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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