I can’t seem to understand why I cant pass any values with the following code:
<div class="menu">
Por favor seleccione os conteúdos:
<form name="Categorias" action="Elementos_Descritivos.php" method="post">
<?php
$Categorias = array ("Nome", "Data", "Cliente", "Observacoes");
foreach( $Categorias as $key => $value){
echo "<div class=\"cb-row\">
<label for=\"$value\">$value:</label>
<input id=\"$value\" $value=\"$value\" type=\"checkbox\" value=\"$value\" checked />
</div>";
}
?>
<div class="submit">
<input type="submit" value="Seguinte" />
</div>
</form>
</div>
</div>
In the Elemento_Descritivos.php page All the code i have is:
<?php
print("<pre>");
print_r($_POST);
print("</pre>");
?>
It simply outputs:
Array
(
)
You need to set the name attribute on all your inputs for a form post to work. The ID is not posted when a form is submitted.
Do the same for your submit button. It will allow you to figure out which submit button was pressed in case you have many in the same form.