[code=php]
<?php
require_once('d atabase_conn.ph p');
session_start() ;
if(isset($_SESS ION['username']))
{
if(isset($_GET['action']) && $_GET['action']=="submit")
{
$cust_id=$_POST['cname'];
echo $cust_id;
}
else
{
?>
<html>
<head>
<script type="text/javascript">
function cust_display()
{
if(document.get ElementById('cn ame').value==0)
{
alert("Please Select Customer Name");
}
else
{
document.getEle mentById('cust_ id').value=docu ment.getElement ById('cname').v alue;
alert(document. getElementById( 'cust_id').valu e);
window.location ="bill_index.ph p?action=submit ";
}
}
</script>
</head>
<body>
<?php
include('adminl ogin.php');
?>
<form action="#" method="post" name="cust">
<br />
<center>
Select Customer Name :
<select name="cname" id="cname" class="bg2" onChange="cust_ display()">
<option value="0">--Select--</option>
<?php
$query=mysql_qu ery("select cust_name,cust_ id from pms_customer");
while($r=mysql_ fetch_object($q uery))
{
?>
<option value="<?php echo $r->cust_id;?>"><? php echo $r->cust_name;?> </option>
<?php
}
?>
</select>
</form>
<input type="hidden" name="cust_id" id="cust_id" />
<?php
}
?>
</html>
<?php
}
else
{
header("locatio n:login_index.p hp");
}
?>
when i execute this program....unde fined index ...error appers....how to solve thi s problem....
<?php
require_once('d atabase_conn.ph p');
session_start() ;
if(isset($_SESS ION['username']))
{
if(isset($_GET['action']) && $_GET['action']=="submit")
{
$cust_id=$_POST['cname'];
echo $cust_id;
}
else
{
?>
<html>
<head>
<script type="text/javascript">
function cust_display()
{
if(document.get ElementById('cn ame').value==0)
{
alert("Please Select Customer Name");
}
else
{
document.getEle mentById('cust_ id').value=docu ment.getElement ById('cname').v alue;
alert(document. getElementById( 'cust_id').valu e);
window.location ="bill_index.ph p?action=submit ";
}
}
</script>
</head>
<body>
<?php
include('adminl ogin.php');
?>
<form action="#" method="post" name="cust">
<br />
<center>
Select Customer Name :
<select name="cname" id="cname" class="bg2" onChange="cust_ display()">
<option value="0">--Select--</option>
<?php
$query=mysql_qu ery("select cust_name,cust_ id from pms_customer");
while($r=mysql_ fetch_object($q uery))
{
?>
<option value="<?php echo $r->cust_id;?>"><? php echo $r->cust_name;?> </option>
<?php
}
?>
</select>
</form>
<input type="hidden" name="cust_id" id="cust_id" />
<?php
}
?>
</html>
<?php
}
else
{
header("locatio n:login_index.p hp");
}
?>
when i execute this program....unde fined index ...error appers....how to solve thi s problem....
Comment