WordPress 表单处理
我需要在网站中添加一个在 WordPress 框架上运行的基本表单页面。
我准备好了以下原材料: 客户端:html表单布局、css和jquery验证代码。 服务器端:处理 $_POST[] 数据的表单处理程序 php 函数。
我的问题是将这段代码集成到Wordpress框架中。
我看过一些插件,但它们做的事情比我想要的要多得多,而且它们有自己的验证,更改起来很麻烦。
有人能建议一个只允许框架挂钩的良好表单插件吗? 或者我自己编写插件是否值得。
谢谢。
I need to add a basic form page in the website, that runs on WordPress framework.
I have the following raw materials ready:
Client side: html form layout,css and jquery validation code.
Server side: form handler php function that processes the $_POST[] data.
My problem is to integrate this code in the Wordpress framework.
I have looked at some plugins but they are doing much more than I would like and also they have their own validation which is cumbersome to change.
Could anyone suggest a good form plugin that allows just the framework hooks ?
Or is it worthwhile that I should write the plugin myself.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在您使用的主题文件夹中创建一个页面模板来处理此问题。只需为表单添加自定义 PHP 代码和 xHTML 标记即可。设置表单操作时,您所需要做的就是将其设置为发布,页面将发布到自身。这可能需要您添加一些额外的逻辑来查看 $_POST 变量是否已设置并处理它们(如果设置了),但它很简单,干净,并且还可以让您在执行任何类型的操作时向用户提供状态消息成功/失败检查。
或者,您可以考虑使用以下插件,让这变得轻而易举:
You can create a page template in the theme folder you are using that can handle this. Simply add your custom PHP code and xHTML mark up for the form. When setting the form action all you should have to do is set it to post and the page will post to itself. This may require you to add some additional logic to see if the $_POST vars are set and to process them if they are, but it's easy, clean, and will also let you give the user a status message if you are doing any kind of success/failure checking.
Alternatively you could look to using the following plugins that make this a cinch: