Jump to content

php ajax basic help is needed on IE5+


santin

Recommended Posts

first of all I want to say that the script works fine in FF and Chrome, but not on IE.

 

the script is 90% from w3school - http://www.w3schools.com/php/php_ajax_database.asp

 

in my server : http://ballon.inetkey.net/c2/

 

the getuser.php file :

<?php
$q=$_GET["q"];

$con = mysql_connect('localhost', '', '');
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("", $con);

$sql="SELECT DISTINCT model FROM cars WHERE producer = '".$q."'";

$result = mysql_query($sql);

echo "<select name='models'>";
while($row = mysql_fetch_array($result))
{
echo "<option>" . $row['model'] . "</option>";
}
echo "</select>";

mysql_close($con);
?>

 

Whats wrong? why it does not work in IE?

 

Link to comment
Share on other sites

i gave it another look through, and saw some issues. try this instead:

<html>
<head>
<script src="selectuser.js"></script>
</head>
<body>
<form name="form" action="#"> 
<script type="text/javascript>
function getText ( selectNode ) {
  return selectNode.options[selectNode .selectedIndex].text;
}
</script>
Select a User:
<select name="users" id="users" onchange="showUser(getText(this));"> 
<option>Manufacturer...</option>
	<option>Audi</option><option>Susita</option><option>Donkey</option></select>
<div id="models">

<select name="models2" id="models2" onchange="alert(getText(document.getElementById('users'))+'-'+getText(this))">
<option>Models...</option>
<option>Choose manufacturer first...</option>
</select>
</div>
</form>
</body>
</html>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.