Nucleus Posted February 11, 2016 Share Posted February 11, 2016 I am using the below to sent ssh commands through a web interface. Below is an example to get the hostname of a Linux computer. I need to change this form, from a dropdown menu, to checkboxes. I know how to do this in html, but I don't know how to tell php to handle it. Reason is, what if multiple checkboxes are selected? how would target="main" display results from multiple computers? index.html <form action="phpseclib/hostname.php" method="get" target="main"> <select name="clients"> <option value="SelectClient">Select Client</option> <option value="192.168.0.51">Client001</option> <option value="192.168.0.52">Client002</option> <option value="192.168.0.53">Client003</option> </select> <input type='submit' /> </form> hostname.php <?php include('Net/SSH2.php'); include('variables.php'); $ip = $_GET['clients']; $ssh = new Net_SSH2($ip); if (!$ssh->login($user, $pass)) {exit('Login Failed');} echo $ssh->exec('hostname'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/300782-set-variables-from-checkboxes-display-multiple-results/ Share on other sites More sharing options...
requinix Posted February 11, 2016 Share Posted February 11, 2016 How you display results is your decision. So how do you want to display it? For the checkboxes, name them all clients[] and then you'll get an array of values instead of just a single value. Then use a loop to execute the command on every machine. Quote Link to comment https://forums.phpfreaks.com/topic/300782-set-variables-from-checkboxes-display-multiple-results/#findComment-1530995 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.