Hello,
I'm trying to develop a browser interface for my load testing environment.I can ssh into the client machines & run scripts,but also wish to execute them in stages.....kinda stuck here cz i do not know how to store the state of my counter variable...plz find below my code(i have left out the ssh2 and exec bits as the wud be very lengthy).I assume I'm missing something here and I would be really happy if anyone can point me in the right direction....
Admin Interface
<form action="form_action.php" method="GET">
No of Client Machines: <input type="text" name="number" /><br />
<input type="submit" value="GO" />
form_action
<?php
$number = $_GET['number'];
$machineValues = array("milan.surey.ac.uk", "chelsea.surey.ac.uk","unter.surey.ac.uk",
"winter.surey.ac.uk","ter.surey.ac.uk");
for ( $counter = 0; $counter < $number;$counter++) {
echo "$machineValues[$counter]\n";
}//end for
$newnumber = $_POST['number'];
$number=$newnumber + $counter;
echo "<form action='".$_SERVER['PHP_SELF']."' method='post'>New Machines:<input type='text' name='number'><input type='submit' value=' Submit '> </form>";
?>
My desired output is :
No of machines : 1 // i enter 1
milan.surey.ac.uk
New Machines : 'text box' SUBMIT // i enter 1 again
chelsea.surey.ac.uk
New Machines : 'text box' SUBMIT // i enter 1 again
unter.surey.ac.uk
New Machines : 'text box' SUBMIT // i enter 1 again
Instead it works for the first loop
No of machines : 1 // i enter 1
milan.surey.ac.uk
Then prints out the
New Machines : 'text box' SUBMIT // i enter 1 again
Nothing happens.....
Well one obvious reason is the counter variable is initialized to 0 each time,for($counter =0....)How do i get around that?
Secondly,there needs to be a way to store the state of the $counter variable,so that it reflects in the next iteration
Lastly,is the highlighted form part correct?or should i get the new numbers in a diff variable as 'number' is used already once?
the purpose is I could use say 2 machines out of 8 for the test and then after a time delay use 5 and then the last one....
Plz help.Thanks in advance