exec loop
Posted: Mon Mar 21, 2011 9:52 am
Hello i am trying to execute a linux program for every line of a textarea
but this always print the result for last line of text area 
for example is there are 3 lines it print 2 blanks and 1 result...
whats wrong??
Code: Select all
$text = $_POST['links'];
$text = htmlspecialchars($_POST['links']);
$text = nl2br($text);
foreach(explode("\n",$text) as $row)
{
$result = NULL;
$command = 'the command';
exec($command,&$result);
echo $result[0]."<br>";
}
for example is there are 3 lines it print 2 blanks and 1 result...
whats wrong??