I want to trigger a function when I push the button with the name 'toevoegen'. I'm calling the button wit php. When the button is pushed, nothing happens.
My code:
if (isset($_POST['toevoegen']))
{
echo "hello world";
}
........
<?php
$query = "SELECT * FROM product";
$result = mysqli_query($link, $query) or die("Er is een fout opgetreden bij het uitvoeren van de query: \"$query\"");
$i=0;
echo("<table id=\"product\">");
echo("<tr>");
while($rij = mysqli_fetch_array($result))
{
$i++;
$afbeelding = $rij['Img'];
echo("
<td><img src=$afbeelding>
<p>€".$rij['Prijs']."</p>
<p>".$rij['Naam']."</p>
<p><form action=\"\">
<input class=\"nummers\" type=\"number\" name=".$rij['ID']." min=\"1\" max=\"20\">
<input type=\"submit\" value=\"In mandje\" name= \"toevoegen\">
</form></p></td>");
if ($i==3)
{
echo("</tr>");
echo("<tr>");
$i=0;
}
}
echo("</table>");
mysqli_close($link);
}
?>