How to include database data within the e-mail receipt AND carry over form data?
I'm using the WebAssist > Create Email Message behaviour to send an e-mail to the customer on completion of an UPDATE form.
The UPDATE form simply changes one of the product's values in the product table whereas the rest of the form is the customers contact details.
I am carrying over product data in the redirect section of the UPDATE behaviour to my confirmation page (on which Universal Email resides) as follows:
$UpdateGoTo = "reserve-whisky-cask-confirm.php?wbid=".($rsCASKINFO->getColumnVal("wbprodID")) ."&cask=".($rsCASKINFO->getColumnVal("wbprodTITLE")) ."&caskno=".($rsCASKINFO->getColumnVal("wbprodCASKNO")) ."&caskprice=".($rsCASKINFO->getColumnVal("wbprodPRICE")) ."";
What I'd like to do is just carry over the product ID so that I can create a recordset on the confirmation page AND include data from that recordset in the Universal Email email that's sent out. I'm using a separate file, reservecaskreceipt.php, as the template for the Universal Email body.
I can create the recordset on the confirmation page but when I include database data in reservecaskreceipt.php I get the following error:
Notice: Undefined variable: rsCASKINFO in /home/linweb39/n/nathonjoneswebdesign.co.uk/user/htdocs/whiskybroker/reservecaskreceipt.php on line 18
Fatal error: Call to a member function getColumnVal() on a non-object in /home/linweb39/n/nathonjoneswebdesign.co.uk/user/htdocs/whiskybroker/reservecaskreceipt.php on line 18
So I assumed that I'd need to include the database connection script and recordset on the reservecaskreceipt.php page too:
<?php require_once('Connections/csdbmysqli.php'); ?>
<?php require_once('webassist/mysqli/rsobj.php'); ?>
<?php
$rsCASKINFO = new WA_MySQLi_RS("rsCASKINFO",$csdbmysqli,1);
$rsCASKINFO->setQuery("SELECT wbprodID, wbprodTITLE, wbprodPRICE, wbprodCASKNO FROM WBproducts WHERE wbprodID = ?");
$rsCASKINFO->bindParam("i", "".(isset($_GET['wbid'])?$_GET['wbid']:"") ."", "-1"); //WAQB_Param1
$rsCASKINFO->execute();
?>
However this then produces the following error:
Notice: Undefined variable: csdbmysqli in /home/linweb39/n/nathonjoneswebdesign.co.uk/user/htdocs/whiskybroker/reservecaskreceipt.php on line 4
Fatal error: Call to a member function Prepare() on a non-object in /home/linweb39/n/nathonjoneswebdesign.co.uk/user/htdocs/whiskybroker/webassist/mysqli/rsobj.php on line 155
...and I reach a dead end on this part of it. :(
However, I also need to carry over the remaining form data - the customers contact information - so that it's included in the Universal Email body and had the following within my reservecaskreceipt.php template page:
<?php echo((isset($_POST["resvcaskNAME"]))?$_POST["resvcaskNAME"]:"") ?>
<?php echo((isset($_POST["resvcaskNAME"]))?$_POST["resvcaskPHONE"]:"") ?>
<?php echo((isset($_POST["resvcaskNAME"]))?$_POST["resvcaskEMAIL"]:"") ?>
...etc.
But these values do not appear to be carried over from the UPDATE form. If it's just a standard form-to-email then it works but I'm assuming that it doens't because I'm using an UPDATE form and in the process of doing the UPDATE it wipes the form values?
...again I reach a dead end.
How do I include recordset data AND the submitted form data on my reservecaskreceipt.php template page?
Much appreciated.
NJ