•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 429,968 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,662 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 574 | Replies: 0
![]() |
•
•
Join Date: Apr 2007
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
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['receiptno'];
$quantity=$_POST['quantity'];
$productid=$_POST['productid'];
$receiptdate=$_POST['receiptdate'];
$Voucherno=$_POST['Voucherno'];
$expirydate=$_POST['expirydate'];
$value=$_POST['value'];
$companyofissue=$_POST['companyofissue'];
$submit_flag=$_POST['submit_flag'];
//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['receiptno'];
//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'] == $receiptno ? "SELECTED" : "";
print "<option value='".$row['RECEIPTNO']."' ".$selected.">".$row['RECEIPTNO']."</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>";
?>
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['receiptno'];
$quantity=$_POST['quantity'];
$productid=$_POST['productid'];
$receiptdate=$_POST['receiptdate'];
$Voucherno=$_POST['Voucherno'];
$expirydate=$_POST['expirydate'];
$value=$_POST['value'];
$companyofissue=$_POST['companyofissue'];
$submit_flag=$_POST['submit_flag'];
//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['receiptno'];
//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'] == $receiptno ? "SELECTED" : "";
print "<option value='".$row['RECEIPTNO']."' ".$selected.">".$row['RECEIPTNO']."</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>";
?>
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Any ideas make my forums grow? (Website Reviews)
- Ideas for a new XT compatible OS... (Techies' Lounge)
- Need Ideas For Dissertations, Final Year Degree Project (IT Careers and Business)
- Wow...lots wrong with my computer!!! Please look if you have ANY ideas w/o reformatti (Windows NT / 2000 / XP / 2003)
- Any Ideas for Projects???? (*nix Software)
- Group Project Ideas (Geeks' Lounge)
Other Threads in the PHP Forum
- Previous Thread: EazyPortal
- Next Thread: error messages


Linear Mode