tags:

views:

26

answers:

2
<input name="movie" value="1" />
<input name="movie" value="2" />
<input name="movie" value="3" />
<input name="movie" value="4" />
<input name="movie" value="5" />

How do I get values of all these inputs by $_POST?

I can not use an unique name for each <input>.

+2  A: 

Just use name="movie[]"

meder
+4  A: 

In HTML do something like this:

<input name="movie[]" value="1" />
<input name="movie[]" value="2" />
<input name="movie[]" value="3" />
<input name="movie[]" value="4" />
<input name="movie[]" value="5" />

In PHP do something like this:

$movies = $_POST['movie'];
foreach($movies as $movie){
   echo $movie . "<br />"; 
}
silent