Page 1 of 1

how to compare two values from same textbox

Posted: Thu Aug 09, 2012 1:32 am
by khalidhabib.cs
function Show_charges(str,str2)
{
//alert("Working");
var xhr;
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("result").innerHTML=xmlhttp.responseText;
}
}
// alert(str2);
xmlhttp.open("GET","reply.php?q="+str+"&q2="+str2,true);
xmlhttp.send();
}//End of Ajax Function show charges from Database


This is php file
include('../include/db.php');
$q= $_GET['q'];
$q2= $_GET['q2'];
?>
<?php
$sql="SELECT service_amount FROM service_charges WHERE quantityFrom >='1' AND quantityTo <='4'";

and herer function calling

<input type="text" class="num-pallets-input" name="product_qty " id="turface-mvp-num-pallets" onkeyup="Show_charges(this.value,this.value)"/>

Re: how to compare two values from same textbox

Posted: Thu Aug 09, 2012 3:24 am
by social_experiment
Could you explain how the script works plus give an example of what the input would look like