Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8691899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:12:56+00:00 2026-06-13T00:12:56+00:00

I’ve been working on a site for a doctors office. I’m pretty good with

  • 0

I’ve been working on a site for a doctors office. I’m pretty good with HTML/CSS and some PHP, but am still trying to learn Javascript/JQuery.

So the easiest way to describe my problem ( my problem, to me at least, is pretty complex) is with an image (If this isn’t the best way to describe this, please just tell me and I will describe it more in detail):
enter image description here

I have the PHP code that takes the value (that is the location number) passed to it and inserts the location number into the database along with the time of the time the user.

Here’s the PHP code:

<?php
  date_default_timezone_set('America/Denver');

  $apptid = $_REQUEST['apptid'];
  $currentlocation = $_REQUEST['currentlocation'];
  $currentlocationstart = date("Y-m-d H:i:s"); 

  /*** mysql hostname ***/
  $hostname = '******';

  /*** mysql username ***/
  $username = '***********';

  /*** mysql password ***/
  $password = '***************';


  $conn = new PDO("mysql:host=$hostname;dbname=sv", $username, $password);
  /*** The SQL SELECT statement ***/
  $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 filled with a little 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 I have is how to do this with Javascript/JQuery and if my php will work with the Javascript/Jquery. I’d also like to store everything from the initial “Check In” button to when the user hits check out.

Another problem is I need this to happen automatically with AJAX, instead of refreshing the page a lot of times.

Thanks so much for all and any help. If I didn’t explain my problem well enough, please tell me and I’ll fill in more details!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T00:12:57+00:00Added an answer on June 13, 2026 at 12:12 am

    just a quick question first off, are you able to make the fields into one form instead of having them disappear onchange?

    That way when they click check in you can make the form appear, they fill it in, and when they press checkout at the bottom of the form we can use AJAX to submit the form and display a response.

    So that would be something like:

    <script type="text/javascript">
    $(document).ready(function() {
        // Hide the form on load      
        $('#myForm').hide();
        // Hide the completed message
        $('#finished').show();
    });
    
    // When someone clicks checkin this function will be called
    $('#checkIn').click(function(){
        $e = $(this);
        $.ajax({
            type: "POST",
            url: "[URL OF PHP PAGE HERE]", // this page should add date to the database
            data: "checkIn="+$(this).val(), // This will send $_POST['checkIn']
            success: function(){
               // Display the form once the AJAX is finished 
               $('#myForm').show();
            }
        });
    });
    
    // This function will be called when someone uses the select field
    $('.[yourClassName]').change(function(){
        $e = $(this);
        $.ajax({
            type: "POST",
            url: "[URL OF PHP PAGE HERE]",
            data: "yourFieldName="+$(this).val(),
            success: function(){
               // Display the form once the AJAX is finished 
               alert('Done');
            }
        });
    });
    
    // When someone clicks checkOut this function will be called
    $('#checkOut').click(function(){
        $e = $(this);
        $.ajax({
            type: "POST",
            url: "[URL OF PHP PAGE HERE]", // this page should save data to db
            data: "example="+$('select#exampleId').val(), 
            success: function(){
               // Hide the form again 
               $('#myForm').hide();
               // Show the finished div with your success msg
               $('#finished').show();
            }
        });
    });
    </script>
    
    <input type="button" value="Check In" id="checkIn" />
    <form method="post" id="myForm" action="">
        // Build the rest of your form here
        <select name="example" id="exampleId">
            <option value="1">Test</option>
        </select>
    
        <input type="button" value="Check Out" id="checkOut" />
    </form>
    <div id="finished" style="color:#ff0000;">Checked Out</div>
    

    That should be that, except you will of course need to build your own form where my example one is. With the PHP page you send the AJAX to, that should be a regular PHP page which accepts $_POST data just like when you post a form normally.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to create an if statement in PHP that prevents a single post
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I have a jquery bug and I've been looking for hours now, I can't
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.