提交表单并在wordpress中保存数据

时间:2016-03-28 08:48:00

标签: php wordpress

在我的wordpress主题中,我创建了一个简单的页面模板,并将以下简单表单添加到表ps_custom_cat中,该表仅包含idname个字段,{{1}是自动增量

id

上一个表单会将数据保存到表<form name="save_decision" method="get" action="/dal/add_decision_cat.php"> <table> <tr> <th> category name </th> <td> <input name="name"> </td> </tr> </table> <input type="submit" name="submit" value="save"> </form>

我的主题中包含保存操作的文件是(wp-content / themes / mytheme / dal / save_decision.php)

ps_custom_cat

提交for wordpress后将我重定向到404页面而不保存数据,我确定表单路径中的问题,如何解决?

1 个答案:

答案 0 :(得分:0)

您可以使用此功能<?php get_template_part( 'form', 'submit' ); ?>

您的文件名应为form-submit.php。把这个文件放在主题文件夹中。

对于Ex。可湿性粉剂内容/主题/ twentytenchild /形状submit.php

其他解决方案是

从管理员端创建一个页面,然后选择放置逻辑的模板。并对该页面进行操作。