php - Wordpress 自定义表单发布以将数据发送到另一个页面
问题描述
您好,我正在 Wordpress 中创建两个页面:dragdrop-translation.php
并translation-detail.php
使用自定义模板。在第一个中,用户选择几种语言、一个截止日期和必须翻译的文件(.txt 或 .pdf)。应该将这些数据发送到,traslation-detail
但我的 POST 操作有问题。模板放置在wp-content/themes/hello-theme-child-master/dragdrop-translation.php
和wp-content/themes/hello-theme-child-master/translation-detail.php
包含 POST 表单的页面的代码是:
<?php
/**
* Template Name: Drag&Drop - Traslation
*
*/
get_header();?>
<div style="margin-top:120px;">
<!--FIRST PART OF FORM-->
<form method="POST" enctype="multipart/form-data" action="/translation-detail/">
<?php function show_languages_list(){
global $wpdb;
$table_name = "wp_languages_price";
$prepared_query = $wpdb->prepare("SELECT * FROM ".$table_name."");
$results = $wpdb->get_results($prepared_query );
echo '<label for="'.'languages'.'">Select language:</label><select name="'.'languages'.'" id="'.'languages'.'">';
echo '<option value="" disabled selected>Select languages</option>';
foreach($results as $languageCouple){
echo '<option>'.$languageCouple->languages_1.' - '.$languageCouple->languages_2.'</option>';
}
echo '</select>';
}
show_languages_list();?>
<label for="start">Deadline:</label>
<input type="date" id="date" name="trip-start"
min="" max="" placeholder="yyyy-mm-dd">
<br>
<label>Insert text file</label>
<input type="file" name="datafile" id="datafile" size="40" required>
<br>
<input type="submit" value="Calcola preventivo" onclick="checkFields()">
</form>
<br>
<div id="errors" style="color: red;">
</div>
</div>
<script>
//Script for check the datas removed
</script>
<?php get_footer();?>
translation-detail.php 的代码是空的所以我就不贴了。
当我提交数据时,服务器在帖子的操作文件夹上回复 404。我需要在表单的操作字段上放置什么路径?
解决方案
推荐阅读
- python - pjax、eldarion-ajax 和常规请求一起在一个网站上——这正常吗?
- android - recyclerview 强制转换异常?
- ios - 我一直在获取:致命错误:索引超出范围
- javascript - 使用 XMLHttpRequest 时出现“for loop”错误
- javascript - 仅对 img 元素启用 Pinch 缩放
- python - 无法弄清楚为什么程序不提供输出
- python - Flask Sqlalchemy 和 Marshmallow 在引号中返回数组,例如“[Array]”
- python - How to transform my csv file into this scikit learn dataset
- node.js - 使用 node/express 上的书架获取存储在数据库中的项目的 ID
- python - 转置 - 切换行和列