Execute codes in a different page but remain on the same actual php page
- by chupinette
I have a complicated problem here..I have codes to send mail using PEAR which i have tested in a php page called testmail.php.
Now i have my actual application an a page called Cart.php where i have a button called Place Order. When i click on this button, it actually redirects to a url called :
http://localhost/final/index.php?OrderSuccessful which actually displays a message on the page and sends an email. The problem is that when i put the code for email in Cart.php, i get errors. But when i put the url http://localhost/final/testmail.php it actually works.
So i was thinking, is there a way to execute the codes from that testmail.php by remaining on the page Cart.php?
include('Mail.php');
$mail = Mail::factory("mail");
$headers = array("From"=>"[email protected]", "Subject"=>"Your order has been placed ");
$body = "lol";
$mail->send("[email protected]", $headers, $body);
I get the error
Assigning the return value of new by
reference is deprecated