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
https://forums.phpfreaks.com/topic/135939-php-ajax-basic-help-is-needed-on-ie5/
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>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.