Execute codes in a different page but remain on the same actual php page

Posted by chupinette on Stack Overflow See other posts from Stack Overflow or by chupinette
Published on 2010-04-10T11:14:08Z Indexed on 2010/04/10 11:23 UTC
Read the original article Hit count: 257

Filed under:
|
|

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

© Stack Overflow or respective owner

Related posts about php

Related posts about pear