本文介绍了< input type =" time" />值不会插入到MySQL数据库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在数据库中插入值,并将其插入空白。我需要这方面的帮助。
这是时间的变量:

  $ rm_time = $ _POST ['rm-time']; 

PHP
<如果(空($ _ POST ['rm-name'])或空($ _ POST ['rm-details'])){
?> pre>
< h3 style =margin-top:30px; text-align:center; font-size:25px; color:red; DIR = RTL >错误< / H3>
<?php
} else {
$ rm_name = $ _POST ['rm-name'];
$ rm_details = $ _POST ['rm-details'];
$ rm_date = $ _POST ['rm-date'];
$ rm_time = $ _POST ['rm-time'];
$ rm_insert_query = $ db-> query(INSERT INTO reminders(r_name,r_details,r_date,r_time)VALUES('$ rm_name','$ rm_details','$ rm_date','$ rm_time') );
}
}
?>
< form action =reminder.php?rm = makemethod =post>
< table class =rmwidth =autoborder =0px>
< tr>
< td class =rm-form-text>提醒日期/时间:< / td>
< td>< input autofocus =name =rm-datetype =dateid =rm/> /<输入名称rm-timetype =timeid =rm/>< / td>
< / tr>
< tr>
< td class =rm-form-text> Remimnder名称:< / td>
< td><输入名称=rm-nametype =textid =rm/>< / td>
< / tr>
< tr>
< td class =rm-form-text>提醒详情:< / td>
< td>< textarea dir =rtlname =rm-detailsid =rm-ta>< / textarea>< / td>
< / tr>
< tr>
< td colspan =2>< input name =save-remindertype =submitclass =sp-submitvalue =Save! />< / TD>
< / tr>
< / table>
< / form>
出口;


解决方案

更改此项



FROM:<输入名称rm-timetype =timeid =rm/>< / td> p>

TO:< input name =rm-timetype =timeid =rm/>< / td> / code>


I want to insert value in a database and it inserted empty. I want help for this necessary. This is the variable of time :

$rm_time = $_POST['rm-time'];

PHP

    if(empty($_POST['rm-name']) or empty($_POST['rm-details'])){
            ?>
            <h3 style="margin-top: 30px;text-align: center;font-size: 25px;color: red;" dir="rtl">Error</h3>
            <?php
        }else{
            $rm_name = $_POST['rm-name'];
            $rm_details = $_POST['rm-details'];
            $rm_date = $_POST['rm-date'];
            $rm_time = $_POST['rm-time'];
            $rm_insert_query = $db->query("INSERT INTO reminders (r_name, r_details, r_date, r_time) VALUES ('$rm_name', '$rm_details', '$rm_date', '$rm_time')");
        }
    }
    ?>
    <form action="reminder.php?rm=make" method="post">
        <table class="rm" width="auto" border="0px">
            <tr>
                <td class="rm-form-text">Reminder date/time :</td>
                <td><input autofocus="" name="rm-date" type="date" id="rm" /> / <input name"rm-time" type="time" id="rm" /></td>
            </tr>
            <tr>
                <td class="rm-form-text">Remimnder name :</td>
                <td><input name="rm-name" type="text" id="rm" /></td>
            </tr>
            <tr>
                <td class="rm-form-text">Reminder details :</td>
                <td><textarea dir="rtl" name="rm-details" id="rm-ta"></textarea></td>
            </tr>
            <tr>
                <td colspan="2"><input name="save-reminder" type="submit" class="sp-submit" value="Save!" /></td>
            </tr>
        </table>
    </form>
    <?
    exit;
解决方案

change this

FROM : <input name"rm-time" type="time" id="rm" /></td>

TO : <input name="rm-time" type="time" id="rm" /></td>

这篇关于&lt; input type =&quot; time&quot; /&GT;值不会插入到MySQL数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 13:16