Jump to content

need help in my site???


evilboy1151987

Recommended Posts

i will explain what i exactly want :

my site here > http://mwlobby.0fees.net/test/movement.php please visit

have 2 files ajax.php & movement.php

 

ajax.php

<?php
error_reporting (E_ALL);
//...
$q=$_GET["q"];
//if (empty(trim($q))){
if(trim($q) == ''){	
$append = '';
}
else{
$append = ' AND car_quantity = '.$q;
}
$cname=$_GET["cname"];

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

// SELECT car_number FROM cars WHERE car_quantity = '33' AND customer_name ='kimo'
$sql='SELECT car_number FROM cars WHERE customer_name = \''.$cname.'\''.$append;
// $sql="SELECT car_number FROM cars WHERE car_quantity = '".$q."' AND customer_name = '".$cname."'
//";
$result = mysql_query($sql) or die (mysql_error());
echo "<select name='user'>";
while($row=mysql_fetch_assoc($result)) {
echo "<option value=".$row['car_number'].">". $row['car_number']."</option>";
}
echo "</select>";

mysql_close($con);
?> 

=============

 

movement.php

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256" />
<title>test</title>
<script type="text/javascript">
function showUser1(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=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
    }
  }
  var urq = 'ajax.php?q='+str ;
xmlhttp.open("GET",urq,true);
xmlhttp.send();
}
// ==================================
function showUser2(stc)
{
if (stc=="")
  {
  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=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
    }
  }
  var urc = 'ajax.php?cname='+stc ;
xmlhttp.open("GET",urc,true);
xmlhttp.send();
}
</script>
</head>
<body>
<form>
   <p>
     customer name :
     <input name="cname" type="text" id="cname" onchange="showUser2(this.value)" />
   write kimo</p>
   <p>
     car quantity :
     <input name="q" type="text" id="q" onchange="showUser1(this.value)" />
   write 33 or 34</p>
   <p> </p>
</form>
<div id="txtHint"></div>
</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.