User Name Password Register
DaniWeb IT Discussion Community
All
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
Reply
Join Date: Apr 2007
Posts: 3
Reputation: dansmit is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
dansmit dansmit is offline Offline
Newbie Poster

ideas

  #1  
Apr 18th, 2007
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>";
?>
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 11:48 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC