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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T15:18:06+00:00 2026-06-08T15:18:06+00:00

So ill start off with my code: $(function() { $(#employeeName).keyup(function() { var dataString =

  • 0

So ill start off with my code:

$(function() {
$("#employeeName").keyup(function() {
    var dataString = 'find='+ $("#employeeName").val();  
    //alert (dataString);return false;
    $.ajax({
        type: "POST",
        url: "finduser.php",
        data: dataString,
        success: function(response) {
            //On success
            $("#search").html(response);
        }
    });
    return false;
 });
});

That is my ajax to search for an employees name

My html looks similar to this:

<input type='text' id='employeeName' name='employeeName'>
<select id='search' name='id'></select>
<input type='submit'>

Basically, it searches the database and returns <option>‘s with the user’s id as the value, and their name as the name, example: <option value='5'>John Doe</option>

And this all works great, except that when I select a name and submit the form, it doesn’t send the updated option that the person selected, it just sends a blank select(So $_POST['id'] doesn’t exist and throws an error.

How else could I make this work? I tried adding onchange="$('#employeeName').val($(this).val())" to the select so that when they select a name it updates the search box and they can submit the form that way, but that was to no avail..

  • 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-08T15:18:07+00:00Added an answer on June 8, 2026 at 3:18 pm

    If $_POST['id'] doesn’t exist, then your option likely doesn’t have a value.

    If $('#search').val() yields an integer, but it isn’t there when you submit the form, then either your <select> is not a part of the form, or the value gets updated on submit, or you’re submitting a GET request, so that your value is available through $_GET['id'].

    1. Verify that your form has the following attribute: method="POST"
    2. Verify that $('#the-form').serialize() contains “id=5”.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'll start off with a solid example: I have a function that generates hashes
Not sure how else to put that, but I'll start off with a code
Let me start off by apologizing for not giving a code snippet. The project
I'll start off with the code as it should be fairly self-explanatory: <commonControls:SearchTextBox x:Name=searchTextBox
I'll start off by showing the code: create table products ('name' text primary key,
I'll start off with a stripped-down/sanitized version of my code: Model: class DataObj :
First, I'll start off by saying that I do not have control over the
I'll start out by giving you the code I'm working on so that you
Preface Let me start off by saying that I'm a relatively new programmer and
First off let me start by saying I am using CodeIgniter and the Facebook

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.