I am working on a site for the office of doctors. I'm pretty good at HTML / CSS and some PHP, but I'm still trying to learn Javascript / JQuery.
So, the easiest way to describe my problem (my problem is at least quite complicated for me) with an image (If this is not the best way to describe it, just tell me and I will describe it in more detail): 
I have a PHP code that takes a value (i.e. a place number) passed to it, and inserts the location number into the database along with the user time.
Here's the PHP code:
<?php date_default_timezone_set('America/Denver'); $apptid = $_REQUEST['apptid']; $currentlocation = $_REQUEST['currentlocation']; $currentlocationstart = date("Ymd H:i:s"); $hostname = '******'; $username = '***********'; $password = '***************'; $conn = new PDO("mysql:host=$hostname;dbname=sv", $username, $password); $sql = "UPDATE schedule SET currentlocation = ?, currentlocationstart = ? WHERE apptid= ? "; $q = $conn->prepare($sql); $q->execute(array($currentlocation,$currentlocationstart, $apptid)); ?>
Here is the html code (which is populated with a bit of php to populate):
$sql = "SELECT * FROM locations order by patientlocation ASC"; echo "<td><select name=location>"; foreach ($dbloc->query($sql) as $row2) { echo "<option>".$row2['patientlocation']."</option>"; } echo "<option value='Check Out'>Check Out</option>"; echo "</select></td>";
So the problem is how to do this with Javascript / JQuery and if my php will work with Javascript / JQuery. I would also like to save everything from the initial "Check In" button until the user types a check.
Another problem: I need this to happen automatically with AJAX, and not refresh the page many times.
Thank you very much for everyone and for your help. If I donβt explain my problem well enough, tell me and I will write more details!
source share