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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:27:05+00:00 2026-06-17T11:27:05+00:00

I have this code in my find.php file: <select name=EmpName required=required id=’empn’> <option value=

  • 0

I have this code in my find.php file:

<select name="EmpName" required="required" id='empn'>
    <option value="" style="display:none;"></option>    
    <?php

    //get the employee id 
        $employeeId = $_POST['country'];

    //make connection to database, bail if no connection
    $connection = odbc_pconnect('db','','');
    if (!$connection) { exit("Connection Failed: " . $connection); }

    //retrieve usernames and passwords
    $sql = "SELECT EName FROM LoginTable WHERE EmployeeID='$employeeId'";

    $rs = odbc_exec($connection, $sql);

    while(odbc_fetch_row($rs)) {
        $rowJobNum = odbc_result($rs, 'EName');
        printf("<option value='%s'>%s</option>", $rowJobNum, $rowJobNum);
    }

?></select>

I have this code in my index.php file:

<script>
function getXMLHTTP() { //function to return the xml http object
        var xmlhttp=false;  
    try{
        xmlhttp=new XMLHttpRequest();
    }
    catch(e)    {       
        try{            
            xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch(e){
            try{
            xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
            }
            catch(e1){
                xmlhttp=false;
            }
        }
    }

    return xmlhttp;
}



function getCity(strURL) {      

    var req = getXMLHTTP();

    if (req) {

        req.onreadystatechange = function() {
            if (req.readyState == 4) {
                // only if "OK"
                if (req.status == 200) {                        
                    document.getElementById('citydiv').innerHTML=req.responseText;                      
                } else {
                    alert("There was a problem while using XMLHTTP:\n" + req.statusText);
                }
            }               
        }           
        req.open("GET", strURL, true);
        req.send(null);
    }

}
</script>




</head>

<body>

<form method="post" action="" name="form1">
<table width="60%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="150">Country</td>
    <td  width="150"><select name="country" onChange="getCity('find.php?country='+this.value)">
    <option value="">Select Country</option>
    <option value="1">mg05</option>
    <option value="2">Canada</option>
        </select></td>
  </tr>
  <tr style="">
    <td>City</td>
    <td ><div id="citydiv"><select name="city">
        </select></div></td>
  </tr>

</table>  
</form>
</body>
</html>

Here’s the issue… I can’t access the selection from the first drop down menu, the selection from the drop down menu is never going through to find.php. For reference, mg05 in the drop down list is an employee ID, I am working off an example here that was originally formatted for cities/states etc.

Here’s my big issue, if I go to:

$sql = "SELECT EName FROM LoginTable WHERE EmployeeID = '$employeeId'";

and change it to

$sql = "SELECT EName FROM LoginTable WHERE EmployeeID= 'mg05'";

It works perfectly, and returns the correct result. So… obviously the post of data from index.php to find.php isn’t working and I can’t figure out why. I have $_GET and $_POST working in other areas of my site, but not this one.

Any insight as to where I may have gone wrong? I’ve tried using both get and post and nothing has worked.

  • 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-17T11:27:06+00:00Added an answer on June 17, 2026 at 11:27 am

    The problem is that you are expecting the displayed text in the select to be post. This will not occur if the selected option has a value attribute, the value attribute will be used

    <select name="country" onChange="getCity('find.php?country='+this.value)">
        <option value="">Select Country</option>
        <option value="mg05">mg05</option>
        <option value="Canada">Canada</option>
    </select>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have borrowed code from this link PHP regex templating - find all occurrences
I have this code in my products_controller.php: <?php class ProductsController extends AppController{ var $name
I have this code App.Model('users').find(function (err, users) { users.forEach(function(user) { console.log(user.username); }); }); //make
I have searched but can't find why this simple code will fail in Drools
If I have a block of code like this: def show @post = Post.find(params[:id])
I have been unable to find any decent documentation on this function. The code
I have been struggling to find a solution to this problem. In my code,
I have this code <div id=main style=background:#aaaaaa;float:left;height:160px;margin:5px;position:relative;display:block;width:630px;> <div id=1 class=item style=background:#ffaacc;float:left;width:200px;height:150px;margin:5px;position:absolute;left:0px;top:0px;> </div> <div id=2
I have this xml file: <test time=11.11.2011 11:11 > <field type=one value=10/> <field type=two
I have a html file which select images from user's computer.code is given bellow

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.