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 7896647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:56:54+00:00 2026-06-03T07:56:54+00:00

I have an HTML text input field – for example: <input id=CustID name=CustID dir=rtl

  • 0

I have an HTML text input field – for example:

<input id="CustID" name="CustID" dir="rtl" value="<? echo $CustID;?>" size="35" required="true" maxlength="9" >

When I insert the number of the user, I need to open a select box to show all ticket for this user.

for example

    <select name="ticket" id="ticket" >
<? 
$query="SELECT * FROM ticket where CustID='$CustID' ";
$result=mysql_query($query) or die("error: " . mysql_error());
while($row=mysql_fetch_array($result))
{
?>  
    <option  value="<?php echo $row['ticket'] ; ?>"><?php echo $row['ticket'] ; ?></option>   
<? }  ?>
    </select>

How can i use this with AJAX?

This is what I have so far:

<script src="js/jquery.js"></script>
<script language="javascript">
function getData(id) {
        $.ajax ({
           url: "php_page.php",
           type: "POST",
           data: {custid:id},
           success: function(data){
                    $("#return").html(data)
                    }
        )} // i have error her why ??
}

</script>

   <input type="text" value="<?php echo $CustID;?>" onkeyup="getData(this.value)"/>
    <?   
    include("functions/connect.php");
    $query = "select * from customers2 ,  tickets where customers2.CustID='".$CustID."' and tickets.CustNo=customers2.CustomersNo";
    $result=mysql_query($query) or die("error: " . mysqli_error());
    while($row=mysql_fetch_array($result))
    {
    ?>  
      <option  value="<?php echo $row['ticket'] ; ?>"><?php echo $row['ticket'] ; ?></option>   
    <? }  ?>
    </select>
  • 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-03T07:56:55+00:00Added an answer on June 3, 2026 at 7:56 am

    Put your php on a separate page called php_page.php. Create your ajax call using the jquery library on your display page:

    function getData(id) {
            $.ajax ({
               url: "php_page.php",
               type: "POST",
               data: {custid:id},
               success: function(data){
                        $("#return").html(data)
                        }
            )}
    }
    

    On your form page create a div with id “return” where you want your select options to show up and also call this function either with a button click or onkeyup:

       <input type="text" value="<?php echo $CustID;?>" onkeyup="getData(this.value)"/>
    

    Oh, and your mysql connect should use the mysqli library:

        $con=mysqli_connect($host,$username,$password,$database);
        $query = //same as before
        $result=mysqli_query($query) or die("error: " . mysqli_error());
        while($row=mysqli_fetch_array($result))
        {
          ?>  
          <option  value="<?php echo $row['ticket'] ; ?>"><?php echo $row['ticket'] ; ?></option>   
        <? }  ?>
        </select>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following HTML code: <td> <input type=text size=40 value= name=related_image id=related_image> <input
Newbie question... The objective: I intend to have an HTML text input field as
I have some HTML like this: <input type=radio class=MyRadio name=TheName> <label for=TheLabel>the text</label> How
I have got a simple HTMl form with one field as follows: <input type=text
I have following HTML code. writer input field is text filed. but I want
If I have an HTML input field like this one: <input type=text id=mytextfield/> all
I have a html form with text input field. I'm wondering how to recognize
I have a HTML form with a file upload field and a text input
HTML <input type='text' id='costs' value='100' size='3'></input> JQuery var costs = $(#costs); var c =
I have the following HTML: <input type=email id=email> I want to type text into

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.