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
https://forums.phpfreaks.com/topic/201736-need-help-in-my-site/
Share on other sites

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.