How do I pass rows from HTML form to PHP? -


i'm written php program display tab delimited file. purpose of allow user views rows , select ones want checking checkbox given in row each record. after hit submit have php program display values, problem last row's id being passed. however, when user hits submit button can see values rows checked:

   process_form.php?download=5108&download=5110&download=5114 

how should parse in process_form.php? i've done var_dump of $_post , $_request shows last value 5114. kind of understand problem, of time in forms programmers 1 value per input field, happens when there many records? doesn't seem should have own unique 'name'.

<td align=center><input type="checkbox" name="download" value="<?php echo $row['id']; ?>"></td> 

i'm doing wrong here, i'm not sure what. there way pass array (i'm guessing) of ids? or should looking @ parsing url of ?download=5108&download=5110&download=5114 because has values need there? if so, how do that? thanks!

this solution:

<td align=center><input type="checkbox" name="download[]" value="<?php echo $row['id']; ?>"></td> 

notice download download[], creating array passed php program process form.

then using demo php code able access array:

$my_array = ($_request["download"]); print_r($my_array); echo "<p>"; foreach ($my_array $value) {     echo $value . "<br>"; } 

Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -