dansmit 0 Newbie Poster

any one any ideas with this just trying to update the total value of a receipt after a money off voucher has been added to it here is the error

Parse error: parse error in /homedir/ilex-s04/dsmith25/public_html/voucher.php on line 146

here is the script

<!-- voucher.php -->
<?php
putenv("TNS_ADMIN=/u1/oracle/Products/shu10g/network/admin");
$conn = OCILogon("wkagonye","maniki", "shu10g");
$receiptno=$_POST;
$quantity=$_POST;
$productid=$_POST;
$receiptdate=$_POST;
$Voucherno=$_POST;
$expirydate=$_POST;
$value=$_POST;
$companyofissue=$_POST;
$submit_flag=$_POST;
//First check to see whether data has been submitted, or whether we need to display the form
//The submit_flag is a hidden field on the form - see below...
if (is_null($submit_flag)) {
print "
<HTML>
<HEAD><TITLE>
voucher Data Entry
</TITLE></HEAD>
<BODY>
<center>
<h3>voucher Data Entry</h3>
<form action='voucher'.php' method='post'>";
$receiptno=$_REQUEST;
//Populate a list of valid receipt numbers in a drop-down list
$query = "SELECT receiptno FROM tblreceipt";
$statement = OCIParse ($conn, $query);
OCIExecute ($statement);
print "Receipt No. ";
print "<select name='receiptno'>";
while (OCIFetchInto ($statement, $row, OCI_ASSOC)) {
$selected = $row == $receiptno ? "SELECTED" : "";
print "<option value='".$row."' ".$selected.">".$row."</option>";
}
print "</select>";
print "
<p>
<label>Voucherno
<input type='text' name='Voucherno' value=''/>
</label>
</p>";
print "
<p>
<label>Expirydate
<input type='text' name='expirydate' value=''/>
</label>
</p>";
print "
<p>
<label>value
<input type='text' name='value' value=''/>
</label>
</p>";


print "
<p>
<label>companyof issue
<input type='text' name='companyofissue' value=''/>
</label>
</p>";
print "
<input type='submit' name='Submit' value='Submit' />
<input type='hidden' name='submit_flag' value='Y' />
</form>
<BR><A HREF='receiptheader.php'>Click Here</A> to cancel and go back to the list of receipt headers</B>
</center>
";
//If the submit flag was not null then we shall try to insert the new recordw
} else {
//Validate the data entry
if (is_null($receiptno) or $receiptno == "") {
$errmsg  = "<LI>You have not selected a Receipt No. from the list</LI>";
} elseif (is_null($Voucherno) or $Voucherno == "") {
$errmsg .= "<LI>You have not entered a voucherno </LI>";
} elseif ($expirydate > SYSDATE or $expirydate == "") {
$errmsg .= "<LI> this voucher has expired or one has not been entered</LI>";
} elseif (is_null($value) or $value == "") {
$errmsg .= "<LI>You have not entered a value </LI>";
} elseif (is_null($companyofissue) or $companyofissue == "") {
$errmsg .= "<LI>You have not entered a companyofissue </LI>";
}
//If an error was found then dont do the insert - print error message instead
if (!is_null($errmsg) ) {
print "
<HTML>
<HEAD><TITLE>
voucher Data Entry Validation Error!
</TITLE></HEAD>
<BODY>
<center>
<h3>The voucher details failed validation for the following reasons</h3>
<ul>";
print $errmsg;
print "
</ul>
<B><BR><BR>Please <A HREF='voucher.php'>Click Here</A> to try again</B>
<BR>Or <A HREF='receiptheader.php'>Click Here</A> to go back to the list of receipt headers</B>
</center>";
//All validation checks were successful, so go ahead and insert the row
} else {
print "
<HTML>
<HEAD><TITLE>
voucher Details Accepted
</TITLE></HEAD>
<BODY>
<center>
<h3>voucher details successfully accepted</h3>";
//Firstly insert the new voucher details
$sql = "INSERT INTO tblvoucher (receiptno, Voucherno, expirydate, value, companyofissue)
VALUES (".$receiptno.",'".$Voucherno."','".$expirydate."',".$value.",'".$companyofissue."')";
$stmt = OCIParse($conn, $sql);
OCIExecute($stmt);
$sql = "UPDATE tblreceipt
SET tblreceipt.totalvalue = tblreceipt.totalvalue - tblvoucher.value
WHERE tblreceipt.receiptno= tblvoucher.receiptno
$stmt = OCIParse($conn, $sql);
OCIExecute($stmt);
print "<B>Thank you for the voucher details, these have been successully accepted.</B>
<UL>
<LI><B>Receipt No:</B>  ".$receiptno."</LI>
<LI><B>Voucherno:</B>  ".$Voucherno."</LI>
<LI><B>expirydate:</B>    ".$expirydate."</LI>
<LI><B>value:</B>    ".$value."</LI>
<LI><B>companyofissue:</B>    ".$companyofissue."</LI>
</UL>
<BR><BR>Please <A HREF='voucher.php?receiptno=".$receiptno."'>Click Here</A> if you'd like to add another voucher</B>
<BR>Or <A HREF='receiptheader.php'>Click Here</A> to go back to the list of receipt headers</B></center>";
}
}
print "
</BODY></HTML>";
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.