hi frnd,
i have a html form with some text fields and i have a check box that when i click on it the data form 1st text box come to the next one.
its working fine when i write the text in text box.
but if i use php value to the 1st text box retrived from database
the javascript gives an error that object expected.
i give my code here:
<?php
session_start();
$sid=$_SESSION['sid'];
$xyz=$_SESSION['username'];
include 'mysql-connect.php';
$sql=mysql_query("SELECT fullname FROM user_info WHERE username='$xyz'");
$r=mysql_fetch_array($sql);
$fullname=$r['fullname'];
echo $fullname;
$sql1=mysql_query("SELECT * FROM seller_acc_info WHERE username='$xyz'");
$n=mysql_num_rows($sql1);
if($n==0)
{
?>
/*ITS WORKING*/
<script language="JavaScript" type="text/javascript" src="checkout.js"></script>
<form action="abc.php" method="post" name="frmCheckout" id="frmCheckout" onSubmit="return checkShippingAndPaymentInfo();">
<table width="550" border="0" align="center" cellpadding="5" cellspacing="1" class="entryTable">
<tr class="entryTableHeader">
<td colspan="2">Billing Information</td>
</tr>
<tr>
<td width="150" class="label">Full Name</td>
<td class="content"><input name="txtShippingFirstName" type="text" class="box" id="txtShippingFirstName" size="30" maxlength="50"></td>
</tr>
</table>
<p> </p>
<table width="550" border="0" align="center" cellpadding="5" cellspacing="1" class="entryTable">
<tr class="entryTableHeader">
<td width="150">Payment Information</td>
<td><input type="checkbox" name="chkSame" id="chkSame" value="checkbox" onClick="setPaymentInfo(this.checked);">
<label for="chkSame" style="cursor:pointer">Same as Billing information</label></td>
</tr>
<tr>
<td width="150" class="label">Full Name</td>
<td class="content"><input name="txtPaymentFirstName" type="text" class="box" id="txtPaymentFirstName" size="30" maxlength="50"></td>
</tr>
</table>
<p> </p>
<input class="box" name="btnStep1" type="submit" id="btnStep1" value="Proceed >>">
</form>
<?php
}
else
{
?>
/*ITS NOT WORKING*/
<form action="abc.php" method="post" name="frmCheckout" id="frmCheckout" onSubmit="return checkShippingAndPaymentInfo();">
<table width="550" border="0" align="center" cellpadding="5" cellspacing="1" class="entryTable">
<tr class="entryTableHeader">
<td colspan="2">Billing Information</td>
</tr>
<tr>
<td width="150" class="label">Full Name</td>
<td class="content"><input name="txtShippingFirstName" type="text" class="box" id="txtShippingFirstName" size="30" maxlength="50" value="<?php echo $fullname; ?>"></td>
</tr>
</table>
<p> </p>
<table width="550" border="0" align="center" cellpadding="5" cellspacing="1" class="entryTable">
<tr class="entryTableHeader">
<td width="150">Payment Information</td>
<td><input type="checkbox" name="chkSame" id="chkSame" value="checkbox" onClick="setPaymentInfo(this.checked);">
<label for="chkSame" style="cursor:pointer">Same as Billing information</label></td>
</tr>
<tr>
<td width="150" class="label">Full Name</td>
<td class="content"><input name="txtPaymentFirstName" type="text" class="box" id="txtPaymentFirstName" size="30" maxlength="50"</td>
</tr>
</table>
<p align="center">
<input class="box" name="btnStep1" type="submit" id="btnStep1" value="Proceed >>">
</p>
</form>
<?php
}
?>
and my java script code is:
function setPaymentInfo(isChecked)
{
with (window.document.frmCheckout) {
if (isChecked) {
txtPaymentFirstName.value = txtShippingFirstName.value;
txtPaymentFirstName.readOnly = true;
} else {
txtPaymentFirstName.readOnly = false;
}
}
}
plz help me i dont understand what the problem...
plz its make very big problem for me..
thanks