PHP script does not work in a specific order -
i have simple html code displays image using link php script shown below. upon loading html page, want display image in browser , send email specific email addess.
the php script listed below working fine intended. however, when move "show image in browser client" code top bottom of script, program sends email , not return image html page. can somone tell me why happening , how can fix it.
html page code:
<body> <img src="http://www.inoxel.com/test/image&email.php > </body>
image&email.php php script file works:
<?php // show image in browser client. $logo = "http://www.inoxel.com/test/happy_face2.gif"; // set image full path readfile($logo); // send test email. ini_set( 'display_errors', 1 ); error_reporting( e_all ); $from = "mblasberg@inoxel.com"; $to = "menb@pacbell.net"; $subject = "php mail test script"; $message = "this test check php mail functionality"; $headers = "from:" . $from; mail($to,$subject,$message, $headers); echo "test email sent"; ?>
image&email.php php script file not work:
<?php // send test email. ini_set( 'display_errors', 1 ); error_reporting( e_all ); $from = "mblasberg@inoxel.com"; $to = "menb@pacbell.net"; $subject = "php mail test script"; $message = "this test check php mail functionality"; $headers = "from:" . $from; mail($to,$subject,$message, $headers); echo "test email sent"; // show image in browser client. $logo = "http://www.inoxel.com/test/happy_face2.gif"; // set image full path readfile($logo); ?>
consider line second:
echo "test email sent";
your browser attempt parse text part of image , fails miserably. therefore shouldn't output text if plan show image through readfile()
.
Comments
Post a Comment