Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need some small assistance

Status
Not open for further replies.

MrMentally

Technical User
Aug 29, 2010
2
0
0
US
I have a PHP page where as I copied an example and am modifying the results.

However I am a tinkerer not a full programmer and I need to be shown how to stop the action from taking place and send the data to a send receipt page. Here is the culprit...

if($_REQUEST['command']=='update'){
$name=$_REQUEST['name'];
$email=$_REQUEST['email'];
$address=$_REQUEST['address'];
$phone=$_REQUEST['phone'];

$result=mysql_query("insert into customers values('','$name','$email','$address','$phone')");
$customerid=mysql_insert_id();
$date=date('Y-m-d');
$result=mysql_query("insert into orders values('','$date','$customerid')");
$orderid=mysql_insert_id();

$max=count($_SESSION['cart']);
for($i=0;$i<$max;$i++){
$pid=$_SESSION['cart'][$i]['productid'];
$q=$_SESSION['cart'][$i]['qty'];
$price=get_price($pid);
mysql_query("insert into order_detail values ($orderid,$pid,$q,$price)");
}
die('Thank You! your order has been placed!'); <---- HOW DO I STOP THIS AND GET IT TO TRANSFER THE CUSTOMER DATA TO THE MAIL SEND PAGE AFTER SUBMISSION TO DATABASE?????????
}
?>

Any assistance would be appreciated.

Mr Mentally
 
just replace the die command with a reference to whatever function you use to email.

if you have the mail script on another page, use
Code:
include 'path/to/script.php';
 
Thank you wasn't really sure how to next step it...

However to go a bit more I need it to go to another form page would this also be the same way I would call it threw?

Thanks for the hand.

Kinda new and stupid at PHP
 
php will continue doing whatever you want it to do until you stop it (with certain safety valves). So it is perfectly fine to do this:

Code:
function processForm(){
  //do things 
}
function sendEmail(){
 //send an email 
}
function showForm2(){
 //show the user the next form
}
if($_POST['submit']){
  processForm();
  sendEmail();
  showForm2();
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top