I want to use javascript read the entered textbox.value and pass it to my php file, but it seems nothing is being passed.
when i run the php it self and store a number into the $q variable the php code works but when i pass the value nothing will be passed, please help.
pages are in admin/index.php for the form and admin/get_order.php for the search query.
Note the script is in the index.php <head>
here is the code
<script type="text/javascript">
var xmlHttp;
function showOrder()
{
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;
}
}
xmlHttp=new XMLHttpRequest();
var str=documnent.list.order_IDsearch.value();
var url="admin/get_order.php";
url=url+"?v="+str;
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send();
}
</script>
get_order.php
<?php
$q=$_POST["q"];
//$_POST['order_IDsearch'];
$con = mysql_connect('localhost', 'root', '');
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("userinfo", $con);
$sql = "UPDATE order_detail SET freelancer_st = 'h' where order_id='".$q."' ";
//WHERE order_id = '".$a."'";
//"SELECT * FROM order_detail WHERE order_id = '".$q."'";
$result = mysql_query($sql);
?>

New Topic/Question
Reply


MultiQuote




|