0

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;
1
  • What format is rm-time in, and what format is the column? Commented Jun 9, 2017 at 12:33

2 Answers 2

1

here your syntax is wrong.

Use

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

instead of

<input name"rm-time" type="time" id="rm" />
Sign up to request clarification or add additional context in comments.

Comments

0

change this

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

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.