【发布时间】:2017-04-27 23:03:25
【问题描述】:
我有这个表单区域:
<table width="200" cellpadding="5" cellspacing="0" border="0">
<tr>
<td><label class="form_text">
<input type="radio" name="date_pref" value="gregorian" id="date_pref-0"> Gregorian</label>
</td>
</tr>
<tr>
<td><label class="form_text">
<input type="radio" name="date_pref" value="hebrew" id="date_pref-1"> Hebrew</label>
</td>
</tr>
</table>
而要插入 SQL 表的 PhP 是
<?php if(isset($_POST['submit'])){
$email=$_POST['cemail'];
$password=$_POST['cpass'];
$cname=$_POST['cname'];
$dname=$_POST['dname'];
$dateeng=$_POST['dateenglish'];
$datehebrew=$_POST['datehebrew'];
$date_pref=$_POST['date_pref'];
}
$table_name='candle_number';
$wpdb->insert( $table_name, array
( 'userid' => $user_id, 'dname' => $dname ,'dateenglish' =>
$dateeng,'datehebrew' => $datehebrew, 'dateformat' => $date_pref ));
但是现在发生的事情是没有结果被创建。我想也许我没有为 SQL 正确格式化无线电结果,但我似乎找不到简明的答案。 SQL 行被格式化为 VARCHAR。任何帮助都会很棒。
编辑:SQL 行是
date format VARCHAR(10) NULL
【问题讨论】:
-
你能发布表定义吗?也许您在插入语句中遗漏了一些不可为空的列?
-
基于 HTML 的 sn-p,似乎
$_POST会有一个成员名称为单选按钮输入 (name="date_pref") 即$_POST['date_pref'],但我没有看到对此的参考。 -
为什么同时使用 mysql 和 sql-server 标签,你使用的是哪个 RDBMS?
-
这是我第一个真正的后端项目。它可能不是 100% 准确的,而且我正在快速学习。
-
为什么反对票 2 反对?
标签: php mysql sql-server wordpress forms