简体   繁体   English

如何将表单输入传递到Wordpress页面?

[英]How to pass form input to Wordpress page?

I've got a small but persistent issue on my WordPress website. 我的WordPress网站上存在一个小而持久的问题。

On my homepage I have a form: 在我的主页上有一个表格:

<form method='post' action='/test/' > 
    Input: <input type="text" name="input">
    <input type="submit">
</form>

With this form I'm trying to pass and use the input value on another page. 通过这种形式,我试图在另一页上传递和使用input值。

I believe action should = 'test.php' not /test/ ( /test/ is the URL of a regular WordPress page). 我认为action应该= 'test.php'而不是/test//test/是常规WordPress页面的URL)。 I can't seem to access any X.php pages in the URL, as it 404's every time (excluding index.php , which doesn't 404, instead it just redirects from domain.com/index.php to domain.com 我似乎无法访问URL中的任何X.php页面,因为它每次都是404(不包括不是404的index.php ,而是仅从domain.com/index.php重定向到domain.com

I've tried creating a new php template (which I can use as a page template to customize the /test/ page), but it still 404's if I try to use action = 'new-template.php' in the form. 我尝试创建一个新的php模板(可以将其用作页面模板来自定义/test/页面),但是如果我尝试在表单中使用action = 'new-template.php' ,它仍然是404。

Any suggestions on how I can pass the form data to another page in this scenario? 关于在这种情况下如何将表单数据传递到另一个页面的任何建议?

I can give you a simple example, 我可以举一个简单的例子

1st create a template and assign it to page eg. 1创建一个模板,并将其分配给页面,例如 test123 // you can hide it from custom site map creation. test123 //您可以在自定义站点地图创建中将其隐藏。

then you can call that page as form submit page 然后您可以将该页面称为表单提交页面

<form method='post' action='<?php bloginfo('url'); ?>/test123/' >

try this you can write your php code inside the template. 试试这个,您可以在模板中编写您的php代码。

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

相关问题 如何以php形式将输入值的一页传递到另一页? - how to pass input value one page to antother page in php form? 如何使用jQuery将表单输入字段值传递给外部页面 - How to pass form input field value to external page using jquery 如何将数据从输入表单传递到另一个页面上的js - How to pass data from input form to js on another page 如何将值从输入表单传递到laravel中的另一个页面 - how to pass value from input form into another page in laravel 如何将输入字段值从一个表单传递到 Woocommerce 不同页面中的另一个表单 - How to Pass a input field value from one form to another form in the different page in Woocommerce 将输入值传递给差异url上的另一种形式并运行Submit wordpress - pass input value to another form on a diff url and run submit wordpress 经过<p>以强大的形式标记到输入字段中 - wordpress</p> - pass <p> tag into input field in formidable form - wordpress Wordpress联系表格7将POST vars传递给感谢页面 - Wordpress Contact Form 7 pass POST vars to thanks page 如何将数据传递到WordPress管理页面上的javascript? - How to pass data to javascript on a WordPress Admin page? 如何将wordpress页面标题传递给wufoo javascript - How to pass a wordpress page title to a wufoo javascript
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM