Jump to content

winter-ale

New Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by winter-ale

  1. thanks for the help everyone! it's been sorted.
  2. No change... thanks though. Cant figure this out!
  3. Thanks, I've added this, but still no resuts. Regarding the on() method, I am not familiar... if you have any details please let me know. Regarding mysqli, I am aware, but not about to start mid way through a rather large application.
  4. Hello all, looking for some help here as I seem to be fairly stuck... this yields no results at all and I give up, I need help! The user should be able to select an employee from a select field, and based on their selected we should be able to grab the start time and end time of that empoyee, which resides on the database. My form: <form action=".php" name="absence" id="absence" method="post"> Employee: <select name="empid" class="clockinputs" required> <option value=""></option> <option value='20'>Bob Jones</option> <option value='13'>Bob Phones</option> <option value='93'>Bob Lomes</option> <option value='30'>Bob Somes</option> <option value='107'>Bob Pomes</option> <option value='74'>Bob Womes</option> </select> Shift Start: <input type="text" name="startshift" id="startshift" class="clockinputs" data-inputmask="'mask': '99:99:99'" required> Shift End: <input type="text" name="endshift" id="endshift" class="clockinputs" data-inputmask="'mask': '99:99:99'" required> <input type="hidden" name="eid" value="<?php echo $row{'EID'}; ?>"> <input type="submit" value="Save"> </form> Javascript: <script type="text/javascript"> jQuery(document).ready(function(){ jQuery('#empid').live('change', function(event) { $.ajax({ url : 'absence-get.php', type : 'POST', dataType: 'json', data : $('#absence').serialize(), success: function( data ) { for(var id in data) { $(id).val( data[id] ); } } }); }); }); </script> And absence-get.php: <?php $e = $_POST['empid']; $result = mysql_query("SELECT * FROM employees WHERE EID='$e' "); $row = mysql_fetch_array($result, MYSQL_ASSOC) $startshift = $row{'startshift'}; $endshift = $row{'endshift'}; $arr = array( 'input#startshift' => $startshift , 'input#endshift' => $endshift ); echo json_encode( $arr ); ?> Anyone spot anything? Thank you!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.