Hi Team,
I have made a system where on a dropdown selected value, other 3 textbox values will be chaned...without using database.
I have made it using Ajax...but I have made only one textbox values and genrate other values but could not send to them on different textboxes...
I have made it to take the help of internet but the next part can not be done by me...please help...!
I don't want any database table at here...!
Thanks
What I have tried:
index.php
---------
//include_once("admin/DAO.php");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Intaxfin OnlineSales</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script>
//fuction to return the xml http object
function getXMLHTTP() {
var xmlhttp=false;
try {
xmlhttp=new XMLHttpRequest();
}
catch(e) {
try{
xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e){
try{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e1){
xmlhttp=false;
}
}
}
return xmlhttp;
}
function getAuthCap(strURL)
{
var req = getXMLHTTP();
if (req)
{
//function to be called when state is changed
req.onreadystatechange = function()
{
//when state is completed i.e 4
if (req.readyState == 4)
{
// only if http status is "OK"
if (req.status == 200)
{
document.getElementById('prof_fee').value=req.responseText;
}
else
{
alert("There was a problem while using XMLHTTP:\n" + req.statusText);
}
}
}
req.open("GET", strURL, true);
req.send(null);
}
}
/*function getSalesTax(strURL)
{
var req = getXMLHTTP();
if (req)
{
//function to be called when state is changed
req.onreadystatechange = function()
{
//when state is completed i.e 4
if (req.readyState == 4)
{
// only if http status is "OK"
if (req.status == 200)
{
document.getElementById('sales_tax').value=req.responseText;
}
else
{
alert("There was a problem while using XMLHTTP:\n" + req.statusText);
}
}
}
req.open("GET", strURL, true);
req.send(null);
}
}*/
</script>
</head>
<body style="font: 12px Verdana, Arial, Helvetica, sans-serif;">
<form name="frm1" method="post" action="#" style="padding: 20px; padding-left: 170px;">
Company Incorporation | Authorised Capital (Rs.) | Professional Fess (Rs.) | Sales Tax @ 14.5% | Total Cost | |
<select name="auth_cap" >
<option value="">-- Select Authorised Capital --</option>
<option value="100000">100,000</option>
<option value="200000">200,000</option>
<option value="300000">300,000</option>
<option value="400000">400,000</option>
<option value="500000">500,000</option>
<option value="600000">600,000</option>
<option value="700000">700,000</option>
<option value="1000000">1,000,000</option>
<option value="1500000">1,500,000</option>
<option value="2000000">2,000,000</option>
</select>
| <input type="text" name="prof_fee" id="prof_fee" maxlength="20" disabled="disabled" placeholder="Professional Fees">
| <input type="text" name="sales_tax" id="sales_tax" maxlength="20" disabled="disabled" placeholder="Sales Tax">
| <input type="text" name="ttl_cost" maxlength="20" disabled="disabled" placeholder="Total Cost">
| <input type="submit" name="submit" value="submit">
|
</form>
</body>
</html>
find_ccode.php
-------------
$auth_cap = $_REQUEST['auth_cap'];
switch($auth_cap)
{
case "100000" :
$prof_fee = 15000;
$sales_tax = ($prof_fee * 14.5)/100;
echo $prof_fee;
echo $sales_tax;
break;
/*case "200000" :
echo "15000"; break;
case "300000" :
echo "15000"; break;
case "400000" :
echo "15000"; break;
case "500000" :
echo "20000"; break;
case "600000" :
echo "20000"; break;
case "700000" :
echo "22000"; break;
case "1000000" :
echo "25000"; break;
case "1500000" :
echo "27000"; break;
case "2000000" :
echo "27000"; break;*/
default :
echo "ajax fault: error occurred...!";
}
/*switch($prof_fee)
{
case "15000" :
#$prof_fee = 15000;
$sales_tax = ($prof_fee * 14.5)/100;
#echo $prof_fee;
echo $sales_tax;
break;
} */
?>