Re: Clearing pipe stream and a few other issues.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




<?

$fp=popen("cat","r");
$str=fgets($fp);
pclose($fp);

print $str;

$arr = array();
foreach (explode('&', $str) as $v) {
$split = explode('=', $v);
// urldecode content for readability
$arr[$split[0]] = urldecode($split[1]); // create assoc. array
${$split[0]} = urldecode($split[1]); // form the variables
}

//echo $sender_name . '<br/>' . $arr['sender_name'];
print_r($arr);

$msg = "Sender's Full Name: $sender_name\n";
$msg .= "Sender's E-Mail: $sender_email\n";
$msg .= "Secret Message? $sender_msg\n\n";
?>


What exactly are you trying to achieve and what problems were you having using it as a normal script?


I'm guessing it's some form of a mailing script.

What's wrong with using a regular php script with a mail command:

<?php
$sender_name = htmlentities($_POST['sender_name']);
$sender_email = htmlentities($_POST['sender_email']);
$sender_msg = htmlentities($_POST['sender_msg']);

$msg = "Name: $sender_name\n";
$msg .= "Email: $sender_email\n";
$msg .= "Message: $sender_msg\n";

mail('........');
?>


and then your form posts to this script (change the form action to point to this new file)...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux