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

  • SEARCH
  • Home
  • 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 9066847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T16:48:33+00:00 2026-06-16T16:48:33+00:00

EDIT 1 I am getting courseID from this code: $coursesOutput = ‘<option value=></option>’; while($row

  • 0

EDIT 1

I am getting courseID from this code:

    $coursesOutput = '<option value=""></option>';

    while($row = mysql_fetch_array($result2)){
        $courseID = $row['courseID'];
        $courseName = $row['name'];

        $coursesOutput .= '<option value="' . $courseID . '">' . $courseName . '</option>'; 
    }

My php script is as follows (returning an echo statement)

    <?php

    include ("includes/connect.php");

    $courseID = mysql_real_escape_string($_GET['courseID']);
    $sql = "SELECT tee1, tee2, tee3, tee4, tee5 FROM courses WHERE courseID='$courseID' LIMIT 1";
    $result = mysql_query($sql) or die(mysql_error());

    while($row = mysql_fetch_array($result)){
  $tee1 = $row['tee1'];
  $tee2 = $row['tee2'];
  $tee3 = $row['tee3'];
  $tee4 = $row['tee4'];
  $tee5 = $row['tee5'];
    }

    $teesOutput = '<option value="' . $tee1 . '">' . $tee1 . '</option>';

    if($tee2 != ""){
  $teesOutput .= '<option value="' . $tee2 . '">' . $tee2 . '</option>';
    }
    if($tee3 != ""){
   $teesOutput .= '<option value="' . $tee3 . '">' . $tee3 . '</option>';
    }
    if($tee4 != ""){
  $teesOutput .= '<option value="' . $tee4 . '">' . $tee4 . '</option>';
    }
    if($tee5 != ""){
  $teesOutput .= '<option value="' . $tee5 . '">' . $tee5 . '</option>';
    }

    echo '' . $teesOutput . '';
    die();
    ?>

I am not getting any ajax errors but still nothing populating in my tee selector.
Hope this helps, once again I am overwhelmed by the support here, unbelieveable!

End EDIT 1

I have been unable to figure this AJAX-JQUERY feature out for awhile now. It should be an easy spot for good jQuery programmers.

I want to be able to auto-populate my tee select input after a user selects their course. This is a golf app and courses have several different tee color schemes so each will be course specific.

So far my broken codes are:

HTML

<form id="formAddScore" action="addscore.php" enctype="multipart/form-data" method="post">
    <p class="profile_label">Select Date:</p>
    <input type="text" id="datepicker" name="datepicker" class="score_input" />

    <p class="profile_label">Select Course:</p>
    <select id="course" name="course" class="score_input" onchange="populateTee(this.value)">
        ' . $coursesOutput . '
    </select>

    <p class="profile_label">Select Tee:</p>
    <select id="tee" name="tee" class="score_input">

    </select>

    <p class="profile_label">Actual Score:</p>
    <input id="score" name="score" class="score_input" type="text" size="10" />

    <p class="profile_label">Score ESC (Equitable Stroke Control):</p>
    <input id="scoreESC" name="scoreESC" class="score_input" type="text" size="10" />
    <br/>

    <input id="btnAddScore" name="btnAddScore" class="btn_score" type="submit" value="Add Score" />

</form>

JQUERY

function populateTee(courseID)
{
    $.ajax(
    {
        url: 'includes/populate_tee.php?courseID=' + courseID,
        success: function(data) {
        $("#tee").html(data);
               }
    });
}

PHP

populate_tee.php script WORKS, so I won’t waste your time including it.

I am fairly certain the problem is in the above JQUERY-AJAX script.

Any help would be wonderful.

Thanks in advance.

  • 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-16T16:48:34+00:00Added an answer on June 16, 2026 at 4:48 pm

    Where does courseID come from? Try logging it into the console.
    Does this help?

    function populateTee(courseID){
       $.ajax({
               url: 'includes/populate_tee.php?courseID=' + courseID,
               success: function(data) {
                        //Assuming you're returning the tees list as an indexed array
                        var ops = '';
                        for(var i=0; i<data.length; i++){
                            ops += '<option>'+data[i]+'</option>';
                        }
                        $("#tee").html(ops);
               }
       });
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting a StackOverflow Error in this code: EDIT [XmlAttribute(ID)] public string ID
For this portion of code <label for=gender>I am:</label> <select class=select name=sex id=sex> <option value=0>Gender:</option>
I am getting text from a multiline edit text. I need to identify newline
After removing hash from URL using window.location.hash='' page getting reloaded in firefox. EDIT Example:
This is the recipe for the exception I'm getting (EDIT: ProtoImpl is defined in
I m using MVC architecture in ASP.NET 3.5. In edit I'm getting the above
I'm trying to edit an Android Makefile in the hopes of getting it to
I am getting an error on my browser when i try to edit or
EDIT 07/14 As Bill Burgess mentionned in a comment of his answer, this question
Is there some way to (temporarily) prevent user from changing the value of TrackBar

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.