dtjo87679 2016-12-13 00:07
浏览 66

将单选按钮值插入SQL

I have this form area:

 <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">&nbsp; Gregorian</label>
         </td>
      </tr>
      <tr>
           <td><label class="form_text">
                <input type="radio" name="date_pref" value="hebrew" id="date_pref-1">&nbsp; Hebrew</label>
           </td>
     </tr>
 </table>

and the PhP to insert into the SQL table is

 <?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 ));

But what is happening now is no result is created. I THINK maybe I am not formatting the radio result correctly for the SQL, but I cannot seem to find a concise answer. the SQL row is formatted as VARCHAR. Any help would be great.

EDIT: The SQL row is

 date format  VARCHAR(10) NULL
  • 写回答

2条回答 默认 最新

  • doskmc7870 2016-12-13 01:19
    关注

    Solved! Just a matter of the right $_POST['date_pref']

    评论

报告相同问题?

悬赏问题

  • ¥15 BP神经网络控制倒立摆
  • ¥20 要这个数学建模编程的代码 并且能完整允许出来结果 完整的过程和数据的结果
  • ¥15 html5+css和javascript有人可以帮吗?图片要怎么插入代码里面啊
  • ¥30 Unity接入微信SDK 无法开启摄像头
  • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
  • ¥20 cad图纸,chx-3六轴码垛机器人
  • ¥15 移动摄像头专网需要解vlan
  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算