passing form data to an array
Posted on 2005-04-07
I have created a simple form with a text box to place ips in.
i called the text box id='ips'
when i submit, it goes to a script page with the following code,
$times = "5";
//$lines = file("myips.txt");
$arr = array( $_POST["ips"]=>$ips);
foreach ($arr as $ip => $ips)
passthru("ping -c $times $ips");
What i am trying to do, is be able to put 20 ips in my form and have the for each statement loop through each ip provided by the form so it pings each ip x times and displays the results on the screen.
the above model works but only pings the first ip in the array and ignores the rest.
can anyone tell me where i have messed this up?