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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:46:01+00:00 2026-05-30T10:46:01+00:00

I am getting an undefined index error message on server side when i am

  • 0

I am getting an undefined index error message on server side when i am trying to send a value selected from a dropdown box on client side (javascript/AJAX) to server side (php). I have a feeling that the GET on the client side is not sending the url correctly or if it is it is sending the value as null.

Does anyone have any idea how to solve this issue.
The code on the client is:

<title>test</title>
<script type="text/javascript" src="jquery.js"></script>

<script type="text/javascript">
$(document).ready(function()
{ 
  $.getJSON("process.php", function(fileName) 
{           
    for(var i in fileName)
    {
        fileName[i] = fileName[i].split("../Test/").join("")
        fileName[i] = fileName[i].split(".xml").join("")
        document.dropDown.file[i]= new Option(fileName[i],"../Test/"+fileName[i]+".xml", false)
    }       
});

});

var xmlhttp;
function getFile(str){
alert("xmlprocess.php?filename="+str);
if (str=="")
{
   document.getElementById("txtHint").innerHTML="";
   return;
} 
if (window.XMLHttpRequest)
 {// code for IE7+, Firefox, Chrome, Opera, Safari
 xmlhttp=new XMLHttpRequest();
 }
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange= response(file);
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("txtHint").innerHTML= xmlhttp.responseText;
}
}

xmlhttp.open("GET","xmlprocess.php?filename="+str,true);
xmlhttp.send();
}

</script>
</head>
<body>

<form name = "dropDown">
<Select name = "file" onclick = "getFile(str1)" onchange = "str1 =    this.options[this.selectedIndex].value"></Select>
</form>

<div id="txtHint"></div>
</html>

and the code on the server side is :

<?php   
 ini_set('display_errors',1); 
 error_reporting(E_ALL);

$br = "<br>";
$filename = $_GET["filename"];
echo $filename;
?>
  • 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-05-30T10:46:02+00:00Added an answer on May 30, 2026 at 10:46 am

    Ok guys ive found the answer

    i had to change the onreadystatechange to be equal to a function on client side as shown below

    xmlhttp.onreadystatechange= function(){
       if (xmlhttp.readyState==4 && xmlhttp.status==200)
       {
          document.getElementById("txtHint").innerHTML= xmlhttp.responseText;
       }
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting a JavaScript error when trying to use the JQGrid: Message: 'undefined'
I keep getting an Notice: Undefined index: did error with this query, and I'm
Trying to compile a iPhone/iPad application with SDK3.2 and am getting this error: Undefined
Getting Undefined index: filename error in the below image upload php code. Is there
I am getting an Undefined index error when submitting a form with an un-checked
I'm getting an undefined index error in this code: function get_userdata() { global $db;
How can you easily avoid getting this error/notice in PHP? Notice: Undefined index: test
I am getting the undefined index error as I come for the first time
I'm getting an undefined index error with these variables: id, subj, mid, fin. I
Possible Duplicate: Why am I getting Undefined index from my PHP? $pattern2 = /([A-Za-z0-9\.\-\_\!\#\$\%\&\'\*\+\/\=\?\^\`\{\|\}]+)\@([A-Za-z0-9.-_]+)(\.[A-Za-z]{2,5})/;

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.