In trying to pass multiple values/variables to another script...I have run into an issue. I've spent a good amount of time on it, reading the PHP man, my cookbook, and searching here on the forums without finding a good solution. Please send me in the right direction (as always) 🙂
Using the test script:
<?php
//pass multiple vars of the same name
if($_POST['submit']){
echo var_dump($_POST);
}else{
echo'<h1>Add Node</h1>
<p><form action="'.$_SERVER['PHP_SELF'].'" method="post">
system1: <input type="checkbox" name="1" value="1"></br>
system2: <input type="checkbox" name="2" value="2"></br>
system3: <input type="checkbox" name="3" value="3"></br>
system4: <input type="checkbox" name="4" value="4">
<input type="submit" name="submit" value="submit">
</form></p>';
}
?>
Checking options #1 and #4 gives:
array(3) { [1]=> string(1) "1" [4]=> string(1) "4" ["submit"]=> string(6) "submit" }
...as it should.
What I am trying to do is set each checkbox name to name="id" so that later (in the script it posts to) I can iterate something like foreach($id as $useful_id) and do what I need.
Does anyone have any good suggestions on how I could accomplish this aside from javascript?