Hi,
My main php file uses a FORM to input/change values. When the SUBMIT button is pressed, the main file calls a REQUIRE or INCLUDE statement and it is from here that I update my Oracle db (using an INSERT statement). Here's the code for the require/include file:
<?
//The following merely outputs parsed element pairs.I.e, see both sides of the = sign
//Look up http://www-106.ibm.com/developerworks/web/library/wa-phpform/#code2
echo "<TABLE width=\"100%\" BORDER=1><TR><TD>";
$form_fields = array_keys($_POST);
for ($i = 0; $i < sizeof($form_fields); $i++) {
$thisField = $form_fields[$i];
$thisValue = $_POST[$thisField];
echo $thisField ." = ". $thisValue;
echo "<br />";
}
echo "</TD></TR></TABLE>";
//Create INSERT statement into REQUEST TABLE#################
$q1="INSERT INTO Request_Table
(RequestID, DocumentID, ContactID, ProgrammeID, DateRequested, DateMounted, DeadlineDate, ExpiryDate, Filename, PrintPermissionLetter, PrintPermissionFax, LetterCount, FaxCount, AddToWebpage, DateResolved, PermissionStatusID, RequestDetailsNotes, LicenceTypeID, CurrencyUnitID, ExchangeRate, FeeOrRate, MinPayment, MaxPayment, LicenceNotes, Cost)
VALUES
($RTRequestID, $RTDocumentID, $RTContactID, $RTProgrammeID, to_date('$RTDateRequested','dd-mm-yyyy'), to_date('$RTDateMounted','dd-mm-yyyy'), to_date('$RTDeadlineDate','dd-mm-yyyy'), to_date('$RTExpiryDate','dd-mm-yyyy'), '$RTFilename', '$RTPrintPermissionLetter', '$RTPrintPermissionFax', $RTLetterCount, $RTFaxCount, '$RTAddToWebpage', to_date('$RTDateResolved','dd-mm-yy'), $RTPermissionStatusID, '$RTRequestDetailsNotes', $RTLicenceTypeID, $RTCurrencyUnitID, $RTExchangeRate, $RTFeeOrRate, $RTMinPayment, $RTMaxPayment, '$RTLicenceNotes', $RTCost)";
echo "$q1 <br />";
//echo "ExchangeRate=$ExchangeRate";
//Parse $q1
$q1=@ociparse($melange_conn, $q1);
//Execute $query1. This INSERTs the new row using the newly created documentid
//ociexecute ($q1,OCI_COMMIT_ON_SUCCESS);
$result=ociexecute ($q1, OCI_COMMIT_ON_SUCCESS);
if ($result==TRUE){
echo "<br /><b>Insert Successful: Thanks for Updating this record</b>";}
else{
echo "<br /><b>Insert Failed: Contact DANSTER</b>";}
?>
As you can see there are 2 things going off above.
1. I list out all the variable names and their values
2. I try to perform the INSERT
My Problem:
The variables in (1) are OK, they are what I expect, they reflect the new data put into the form.
HOWEVER, the INSERT statement (2) uses old form values, it does not read in the values I get in (1)!!?
If anyone can help I'd be v grateful 🙂
Danster