Steve2106
|
|
« on: June 08, 2020, 12:29:45 PM » |
|
Hi There,
I'm sure I am doing everything totally wrong but I'm stuck and really need your help.
I have an easyui grid and when I click a button it opens a dialog window with a dropdown. I would like to send the chosen value to a .php file to change a value in my database. below is part of the code of my page with the grid, button and dialog with the dropdown. And below that is my .php code.
<body>
<p></p> <?php echo "Today is: " . date('l jS \of F Y')?> <table id="dg" title="Medic Booking" class="easyui-datagrid" style="width:970px;height:600px" <?php echo "url=get_rei_practitionerscerts.php?id=" . $passedid ?> toolbar="#toolbar" pagination="true" pageSize="20" rownumbers="true" fitColumns="true" singleSelect="true"> <thead> <tr> <th field="practitionerid" width="200">PracID</th> <th field="certname" width="200">Medic Name</th> <th field="date1" width="90" align="center" styler="cellStyler">Date 1</th> <th field="time1" width="70" align="center">Time 1</th> <th field="date2" width="90" align="center" styler="cellStyler">Date 2</th> <th field="time2" width="70" align="center">Time 2</th> <th field="date3" width="90" align="center" styler="cellStyler">Date 3</th> <th field="time3" width="70" align="center">Time 3</th> <th field="date4" width="90" align="center" styler="cellStyler">Date 4</th> <th field="time4" width="70" align="center">Time 4</th> <th field ="detail" width = "40" align="center" formatter="formatDetail">View</th> </tr> </thead> </table> <div id="toolbar"> <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="newBooking()">New Booking</a> <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="destroyBooking()">Delete Booking</a> <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-home" plain="true" onclick="href='index-reiki.php'">Home</a> </div> <?php include("includes/footer.php") ?>
<div id="dlg" class="easyui-dialog" style="width:450px;height:250px;padding:10px 20px" closed="true" buttons="#dlg-buttons"> <div class="ftitle">Assign medic to practiotioner</div> <form id="fm" method="post" novalidate> <div class="fitem"> <input class="easyui-combobox" name="dd_medicid" style="width:350px; margin-bottom:20px" limitToList: true; data-options=" url:'./getmedicnames.php', method:'get', valueField:'medicid', textField:'certname', panelHeight:400, label: 'Medic Name:', labelPosition: 'top' "> </div> </form> </div> <div id="dlg-buttons"> <a href="javascript:void(0)" class="easyui-linkbutton c6" iconCls="icon-ok" onclick="editUser()" style="width:90px">Save</a> <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')" style="width:90px">Cancel</a> </div> <div id="multiusage"></div> <script type="text/javascript"> var url;
function editUser(){ var row = $('#dg').databobox.datagrid('getSelected'); if (row){ $('#dlg').dialog('open').dialog('setTitle','Edit User'); $('#fm').form('load',row); url = './AssignMedictoPractitioner.php?medicid='+dd_medicid.medicid; } $('#dg').datagrid('reload'); // reload the current page data } PHP Code: <?php $db_host = "127.0.0.1"; $db_username = "root"; $db_password = ""; $db = "pracdb"; $conn = new mysqli($db_host,$db_username,$db_password,$db) or die(mysqli_error()); $medicid = intval($_POST['medicid']);
$sql = "update medics set practitionerid=2 where medicid=" . $medicid;
?>
Thanks,
Steve.
|