Search code examples
codeignitertimepicker

Using jquery timepicker with CodeIgniter to update mySQL database


I'm pretty new to timepicker and CodeIgniter but I'm attempting to use a value selected from timepicker's dropdown box to update a database entry, and I'm pretty stumped.

my view:

<div class="input-field col s3">
<input id="ThrStart" type="text" class="time input-field ui-timepicker-input" autocomplete="off">
            <label for="ThrStart">Start Time</label>
        </div>

<div class="input-field col s3">
            <button class="btn waves-effect waves-light red darken-4" type="submit" name="Wed_button" id="webadd">Add</button>
        </div>

I would like to send the currently selected value from the timepicker selection to the database when the "Wed_button" is clicked, but I'm not sure how to select these values in order to use a _POST. Any advise would be appreciated.


Solution

  • Add a form tag and give a name to input box

    <form action="ACTION_URL" method="post">
    <div class="input-field col s3">
    <input id="ThrStart" type="text" name="ThrStart" class="time input-field ui-timepicker-input" autocomplete="off">
            <label for="ThrStart">Start Time</label>
        </div>
    
    <div class="input-field col s3">
            <button class="btn waves-effect waves-light red darken-4" type="submit" name="Wed_button" id="webadd">Add</button>
        </div>
    </form>