Hi every one,
I have used the followinng code for chain/depending combo box.
I want to see the values of every combo box as the selected items.
But I'm unable to do that. Can anyone can help me to do that?
I have heard that using AJAX it can be solved. But I have not any such
type of code. So, you can help me also by giving a such types of AJAX code.
For better understanding, I have attached the database file here which I have
used.
Please help me.
Thank you.
////////////////////////////////////////////////////////////
<html>
<head>
<title>IBTRA Accounts :: Accounts Entry</title>
<style type="text/css">
<!--
.ListText {
font-family: Arial, Helvetica, sans-serif;
font-size: 9pt;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
color: #3366CC;
}
.Text {
font-family: Arial, Helvetica, sans-serif;
font-size: 9pt;
font-style: normal;
font-weight: bold;
font-variant: normal;
color: #003366;
}
.BodyText {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10pt;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
}
.style1 {font-size: 12pt}
.style3 {font-family: Arial, Helvetica, sans-serif; font-size: 11pt;
font-style: normal; line-height: normal; font-weight: normal; font-variant:
normal; color: #3366CC; }
.warning {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 8pt;
font-style: normal;
font-weight: bold;
color: #FF0000;
}
-->
</style>
</head>
<script language="javascript" type="text/javascript">
function setfocus()
{
document.form.Prog.focus();
}
function load_fun()
{
var i=document.form.Prog.value;
var j=i;
location.href="?i="+j;
}
////////////////////////////////
function load()
{
var a=document.form.ProgramId.value;
var c=a;
location.href="?a="+c;
}
//////////////////////////////
function acc_load()
{
var x=document.form.Program.value;
var y=x;
location.href="?x="+y;
}
/////////////////////////////////////
function contra_value()
{
if(document.form.txtAmount.value=='0')
{
alert("Sorry !!! \nThe amount field cannot be zero (0) ! !! !!!");
document.getElementById("txtContraAmount").value ="Wrong input";
document.form.txtAmount.focus();
}
else
document.getElementById("txtContraAmount").value =
document.getElementById("txtAmount").value ;
}
////////////////////////////////////////
function validity()
{
var valid=1;
if(document.form.combo_accounts_head.value=="" ||
document.form.particulars.value==""
|| document.form.txtAmount.value=="" ||
document.form.txtOnAccountOf.value==""
|| document.form.txtContraAmount.value=="Wrong input" ||
document.form.txtContraAmount.value=="" )
{ valid=0;
alert("Sorry!!!\n\nPlease fill up all the fields ! !! !!!\n\n");
document.form.particulars.focus();
}
if(document.form.txtContraAmount.value!=document.form.txtAmount.value)
{ valid=0;
alert("Sorry!!!\n\nAmount and contra amount is not same ! !! !!!\n\n");
document.form.txtAmount.focus();
}
var digits = "0123456789";
for (var i = 0; i < document.form.txtAmount.value.length; i++)
{
temp = document.form.txtAmount.value.substring(i, i+1)
if (digits.indexOf(temp) == -1 && document.form.txtAmount.value != "")
{ valid=0;
alert("Sorry!!!\n\nAmount must be positive numeric value ! !!
!!!\n\n");
document.form.txtAmount.focus();
break;
}
}
if(valid=='0')
return false;
else
return true;
}
//////////////////////////////////
</script>
<?php
$gl_head_type=$_GET['i'];
$_SESSION['gl_head_type']="$gl_head_type";
$id=$_GET['a'];
$_SESSION['id']="$id";
$sub_gl_id=$_GET['x'];
$_SESSION['sub_gl_id']="$sub_gl_id";
?>
<body>
<div align="center"></div>
<form name="form" method="post" onSubmit="return validity()" action="">
<span class="warning"><br>
</span>
<div align="center" class="warning"><?php echo $warning?><br>
<br>
</div>
<table width="60%" border="1" align="center" cellpadding="1" cellspacing="1">
<tr>
<td><table width="98%" border="0" align="center" cellpadding="0"
cellspacing="4">
<tr>
<td rowspan="2" align="center" valign="middle"><div align="center"
class="Text">
<div align="center"> </div>
</div>
<div align="right" class="BodyText">
<div align="left">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"
width="60" height="60">
<param name="movie" value="images/ibbl.swf">
<param name=quality value=high>
<embed src="images/ibbl.swf" quality=high
pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"
type="application/x-shockwave-flash" width="60" height="60"></embed>
</object>
</div>
</div>
</div></td>
<td colspan="5"><div align="center" class="Text"><span
class="style1">Islami Bank Bangladesh Limited</span><br>
<span class="style3">IBTRA Branch </span></div></td>
<td width="79"><div align="right" class="BodyText">F-4/F-5</div></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td colspan="3"><div align="right" class="BodyText">Date:
<script language="JavaScript"
src="popcalendar.js"type="text/JavaScript">
</script>
<input name="text_date" type="text" readonly="" value="<?php echo
date ("d-m-Y")?>" id="text_date" size="10" align="right" >
<img align="absbottom" src="images/date.gif" height="20"
width="34" onclick='popUpCalendar(this,form.text_date, "dd-mm-yyyy")'
title="Press here to select date.">
</div></td>
</tr>
<tr>
<td width="79" bordercolor="#000000" bgcolor="#DFF0FF"
class="Text"><div align="center"><strong>Asset/Liability</strong></div></td>
<td width="65" bordercolor="#000000" bgcolor="#DFF0FF"
class="Text"><div align="center"><strong>GL Head</strong></div></td>
<td width="74" bordercolor="#000000" bgcolor="#DFF0FF"
class="Text"><div align="center"><strong> GL Sub Head</strong></div></td>
<td width="82" bordercolor="#000000" bgcolor="#DFF0FF"
class="Text"><div align="center"><strong>Account Name </strong></div></td>
<td width="90" bordercolor="#000000" bgcolor="#DFF0FF"
class="Text"> <p align="center">Particulars</p></td>
<td width="73" bgcolor="#DFF0FF" class="Text"><div
align="center">D/C</div></td>
<td bgcolor="#DFF0FF" class="Text"><div
align="center">Amount</div></td>
</tr>
<tr>
<td width="79" bordercolor="#000000" class="Text">
<select name="Prog" class="ListText" id="Prog"
onChange='load_fun()' title="Select asset or liability">
<?php
$sql3="select * from head_gl group by gl_head_type";
$sqlres3=mysql_query($sql3);
echo "<OPTION value=''>Select</OPTION>";
while($row3=mysql_fetch_array($sqlres3))
{
echo "<OPTION
value=".$row3[gl_head_type].">".$row3[gl_head_type]."</OPTION>";
} // while
echo "</SELECT>";
?>
</td>
<td width="65" bordercolor="#000000" class="Text">
<select name="ProgramId" class="ListText" onChange='load()'
title="Select one of the GL head...">
<?php
echo "<OPTION value=''>Select</OPTION>";
$sql="select * from head_gl where gl_head_type='".$gl_head_type."'
order by gl_code_no ASC";
$sqlres=mysql_query($sql);
while($row=mysql_fetch_array($sqlres))
{
echo "<option
value=".$row[id].">".$row[gl_head]."</option>";
} echo "</SELECT>";
?>
</td>
<td width="74" bordercolor="#000000" class="Text">
<select name="Program" class="ListText" onChange='acc_load()'
title="Select one of the GL sub head...">
<option value="">Select</option>
<?php
$sql1="select * from head_sub_gl where gl_id='".$id."' group by
sub_gl_head";
$sqlres1=mysql_query($sql1);
while($row1=mysql_fetch_array($sqlres1))
{
echo "<option
value=".$row1[sub_gl_id].">".$row1[sub_gl_head]."</option>";
} echo "</select>";
?>
</td>
<td bordercolor="#000000" class="Text"><select
name="combo_accounts_head" class="ListText" id="combo_accounts_head"
title="Select one of the account name...">
<option value="">Select</option>
<?php
$sql2="select * from accounts_name where
gl_sub_head_id='".$sub_gl_id."' order by account_name ASC";
$sqlres2=mysql_query($sql2);
while($row2=mysql_fetch_array($sqlres2))
{
echo "<option
value=".$row2[a_id].">".$row2[account_name]."</option>";
} echo "</select>";
?>
</td>
<td bordercolor="#000000" class="Text"><input name="particulars"
type="text" id="particulars" size="15" maxlength="50"></td>
<td class="ListText"><select name="debit_credit" id="debit_credit">
<option value="Debit">Debit</option>
<option value="Credit">Credit</option>
</select></td>
<td class="ListText"><input name="txtAmount" type="text"
id="txtAmount" style="text-align:right" value="0" size="8" maxlength="20"></td>
</tr>
<tr class="BodyText">
<td colspan="7">On Account of
<input name="txtOnAccountOf" type="text" id="txtOnAccountOf2"
size="73" maxlength="200"></td>
</tr>
<tr class="BodyText">
<td colspan="7">Contra Account
<input name="txtContra" readonly="" type="text" id="txtContra"
value="Cash in hand" size="15" maxlength="20">
<input name="txtContraAmount" onFocus='contra_value()' type="text"
id="txtContraAmount" style="text-align:right" size="10" maxlength="20"></td>
</tr>
<tr>
<td colspan="7"><div align="right">
<input name="btn_submit" type="submit" id="btn_submit"
value="Submit">
<input type="reset" name="Submit2" value="Reset">
</div></td>
</tr>
</table></td>
</tr>
</table>
<p> </p>
</form>
</body>
</html>
Get your new Email address!
Grab the Email name you've always wanted before someone else does!
http://mail.promotions.yahoo.com/newdomains/aa/
[Non-text portions of this message have been removed]