Page 1 of 1

Undefined Index

Posted: Wed Mar 22, 2006 12:05 am
by Mmondragon
hi, i am getting an error "Notice: Undefined index: txtSellPrice in x:\docs\web.htm on line 13" what is this? what does it mean? i changed my error_reporting to E_ALL & ~E_NOTICE but there's no data on my text box. pls. help and tnx in advance.

Posted: Wed Mar 22, 2006 3:05 am
by Benjamin
Post your code.

Posted: Wed Mar 22, 2006 8:49 pm
by Mmondragon
feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


my code sir:

======================

Code: Select all

<?php
include_once($_SERVER['DOCUMENT_ROOT'].'/misc/includes/classes/cls_vehcomp.inc.php');

$quote_car = &new vehicle_computation;

if (isset($_GET['aor'])) {
	$get_add_on_rate = $quote_car->add_on_rate($_GET['aor']);
	$display_aor = $get_add_on_rate->fields[0];
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../misc/css/default.css" rel="stylesheet" type="text/css">
<script language="javascript" src="../misc/scripts/qqs-computation.js"></script>
</head>

<body>
<table width="100%" border="0" cellspacing="3" cellpadding="3">
  <tr>
    <td><form name="frmQuickQuote" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>" autocomplete="off">
        <table width="570" border="0" cellspacing="0" cellpadding="4">
          <tr> 
            <td colspan="2"><h3><strong>Quick Quote Section</strong></h3></td>
          </tr>
          <tr> 
            <td width="166">&nbsp;</td>
            <td width="388">&nbsp;</td>
          </tr>
          <tr class="bgrow"> 
            <td colspan="2"><div align="left"><strong><font color="#FFFFFF">Customer 
                Information</font></strong></div></td>
          </tr>
          <tr> 
            <td align="left" valign="top"><div align="right">Customer Code/ ID</div></td>
            <td align="left" valign="top"><div align="left"> 
                <input name="txtCustId" type="text" id="txtCustId" size="6" maxlength="6" class="input" value="<?php echo $_GET['txtSellPrice']; ?>">
                <img src="../misc/images/imgfind.jpg" width="21" height="20"></div></td>
          </tr>
          <tr> 
            <td align="left" valign="top"><div align="right">Company/ Customer 
                Name</div></td>
            <td align="left" valign="top"><div align="left"> 
                <input name="txtCustName" type="text" id="txtCustName" size="40" maxlength="75" class="input">
              </div></td>
          </tr>
          <tr> 
            <td align="left" valign="top"><div align="right">Address</div></td>
            <td align="left" valign="top"><div align="left"> 
                <textarea name="txtAddress" cols="45" rows="3" id="txtAddress" class="input"></textarea>
              </div></td>
          </tr>
          <tr> 
            <td align="left" valign="top"><div align="right">Contact Nos.</div></td>
            <td align="left" valign="top"><div align="left"> 
                <input name="txtContactNos" type="text" id="txtContactNos" size="20" maxlength="20" class="input">
              </div></td>
          </tr>
          <tr> 
            <td>&nbsp;</td>
            <td align="left" valign="top">&nbsp;</td>
          </tr>
          <tr class="bgrow"> 
            <td colspan="2"><div align="left"><strong><font color="#FFFFFF">Choose 
                Vehicle Model</font></strong></div></td>
          </tr>
          <tr> 
            <td align="left" valign="top"><div align="right">Unit Model (Variant)</div></td>
            <td align="left" valign="top"><input name="txtUnitModelVar" type="text" id="txtUnitModelVar" size="15" maxlength="15" class="input" value="<?php echo $_GET['txtUnitModelVar']; ?>">
              <img src="../misc/images/imgfind.jpg" width="21" height="20"></td>
          </tr>
          <tr> 
            <td align="left" valign="top"><div align="right">Model</div></td>
            <td align="left" valign="top"><input name="txtModel" type="text" id="txtModel" size="20" maxlength="20" class="input" value="<?php echo $_GET['txtModel']; ?>"></td>
          </tr>
          <tr> 
            <td align="left" valign="top"><div align="right">Color</div></td>
            <td align="left" valign="top"><input name="txtColor" type="text" id="txtColor" size="30" maxlength="45" class="input" value="<?php echo $_GET['txtColor']; ?>">
              <img src="../misc/images/imgfind.jpg" width="21" height="20"></td>
          </tr>
          <tr> 
            <td align="left" valign="top"><div align="right">Selling Price</div></td>
            <td align="left" valign="top"><input name="txtSellPrice" type="text" id="txtSellPrice" size="14" maxlength="14" style="text-align: right;" class="input" onChange="fixed_decimal(this.form); " value="<?php echo $_GET['txtSellPrice']; ?>"></td>
          </tr>
          <tr> 
            <td align="left" valign="top">&nbsp;</td>
            <td align="left" valign="top">&nbsp;</td>
          </tr>
          <tr class="bgrow"> 
            <td colspan="2" align="left" valign="top"><strong><font color="#FFFFFF">Details of Computation</font></strong></td>
          </tr>
          <tr> 
            <td align="left" valign="top"><div align="right">Mode of Payment</div></td>
            <td align="left" valign="top"><select name="cboModePay" id="cboModePay">
                <option value="CashPO">Cash/ PO</option>
                <option value="Fin">Financing</option>
              </select> </td>
          </tr>
          <tr> 
            <td align="left" valign="top"><div align="right">Downpayment</div></td>
            <td align="left" valign="top"><select name="cboTerms" id="cboTerms" onChange="compute_downpayment(this.form);">
                <?php
					for ($ctr = 0; $ctr <= 80; $ctr = $ctr + 5)
						echo '<option value="'.$ctr.'">'.$ctr.'</option>';
				?>
              </select> <input name="txtDownPay" type="text" id="txtDownPay" size="14" maxlength="14" style="text-align: right;" class="input" value="<?php echo $_GET['txtDownPay']; ?>"> 
            </td>
          </tr>
          <tr> 
            <td align="left" valign="top"><div align="right">Balance to be Financed</div></td>
            <td align="left" valign="top"><input name="txtBalFin" type="text" id="txtBalFin" size="14" maxlength="14" style="text-align: right;" class="input" value="<?php echo $_GET['txtBalFin']; ?>"> 
            </td>
          </tr>
          <tr> 
            <td align="left" valign="top"><div align="right">Monthly Installment 
                (MA)</div></td>
            <td align="left" valign="top"><select name="cboMonIns" id="cboMonIns" onChange="go_add_on_rate(this.form.cboMonIns.value);">
                <?php
					$load_addonrates = $quote_car->monthly_installment();
					while (!$load_addonrates->EOF) {
						// To re-populate and set which was selected earlier
						// since this will be refresh once change
						echo '<option value="'.$load_addonrates->fields[0];
						if ($_GET['aor'] === $load_addonrates->fields[0]) {
							echo '" selected>'.$load_addonrates->fields[0].'</option>';
						}
						else {
							echo '">'.$load_addonrates->fields[0].'</option>';
						}
						$load_addonrates->MoveNext();
					}
				?>
              </select> <input name="txtAddOnRate" type="text" id="txtAddOnRate" size="5" maxlength="5" style="text-align: right;" class="input" value="<?php echo $display_aor; ?>">
              <input name="txtMA" type="text" id="txtMA" size="14" maxlength="14" style="text-align: right;" class="input"></td>
          </tr>
          <tr> 
            <td align="left" valign="top"><div align="right">Insurance</div></td>
            <td align="left" valign="top"> 
              <input name="txtInsurance" type="text" id="txtInsurance" size="14" maxlength="14" style="text-align: right;" class="input" value="<?php echo $_GET['txtInsurance']; ?>">
              <img src="../misc/images/imgfind.jpg" width="21" height="20"></td>
          </tr>
          <tr> 
            <td align="left" valign="top"><div align="right">Chattel Mortgage</div></td>
            <td align="left" valign="top"><input name="txtCMF" type="text" id="txtCMF" size="14" maxlength="14" style="text-align: right;" class="input" value="<?php echo $_GET['txtCMF']; ?>">
              <img src="../misc/images/imgfind.jpg" width="21" height="20"></td>
          </tr>
          <tr> 
            <td align="left" valign="top"><div align="right">Rustproof</div></td>
            <td align="left" valign="top"><input name="chkRustProof" type="checkbox" id="chkRustProof" value="checkbox" checked> 
              <input name="txtRustProof" type="text" id="txtRustProof" size="14" maxlength="14" style="text-align: right;" class="input"></td>
          </tr>
          <tr> 
            <td align="left" valign="top"><div align="right">LTO Registration 
                (3 Years)</div></td>
            <td align="left" valign="top"><input name="txtLTOReg" type="text" id="txtLTOReg" size="8" maxlength="8" style="text-align: right;" class="input"></td>
          </tr>
          <tr> 
            <td align="left" valign="top"><div align="right">Others (Accessories)</div></td>
            <td align="left" valign="top"><input name="txtOthers" type="text" id="txtOthers" size="14" maxlength="14" style="text-align: right;" class="input"></td>
          </tr>
          <tr> 
            <td align="left" valign="top"><div align="right">Notarial Fee</div></td>
            <td align="left" valign="top"><input name="txtNotFee" type="text" id="txtNotFee" value="<?php echo number_format($quote_car->notarial_fee(), 2, '.', ''); ?>" size="6" maxlength="6" style="text-align: right;" class="input"></td>
          </tr>
          <tr> 
            <td align="left" valign="top"><div align="right">Cash Discount</div></td>
            <td align="left" valign="top"><input name="txtCashDisc" type="text" id="txtCashDisc" size="14" maxlength="14" style="text-align: right;" class="input"></td>
          </tr>
          <tr> 
            <td align="left" valign="top"><div align="right"><strong><font color="#FF0000">TOTAL 
                INVESTMENT</font></strong></div></td>
            <td align="left" valign="top"><input name="txtTotalInvestment" type="text" id="txtTotalInvestment" size="14" maxlength="14" style="text-align: right;" class="input"></td>
          </tr>
        </table>
      </form></td>
  </tr>
</table>
</body>
</html>

feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Wed Mar 22, 2006 8:59 pm
by feyd
the code posted here may be of help to you.

Posted: Wed Mar 22, 2006 9:00 pm
by Benjamin

Code: Select all

<?php echo if (isset($_GET['txtSellPrice'])) echo { $_GET['txtSellPrice']; } ?>
OR

Code: Select all

<?php echo @$_GET['txtSellPrice']; ?>
Change line 13 to 1 of the above. Many programmers feel the first method is the best way to do it. The second method just supresses the error message if the price isn't set.

Posted: Thu Mar 23, 2006 6:00 pm
by Mmondragon
did not solve the problem sir. it keeps on displaying the same thing... and when i tried to have ~E_NOTICE there's no data either.

Posted: Thu Mar 23, 2006 9:08 pm
by Mmondragon
Now I got another problem that is quite wierd, I am getting: "Notice: Trying to get property of non-object in x:\docs\web.htm on line 8" <same code as what i posted above> But I am only getting this error on mozilla/ firefox browser but not in IE. i'm using php 5.1 thanks!