I'm trying to add a Array to a Multi-Array in a session (by array_push). The Array is filled with variables of a html form. Here's the code:
<?php
session_start();
$_SESSION['warenkorb'] = array();
echo("
<form>
Anzahl: <input style='width: 60px;' type='number' name='anzahl' required/>
<input type='submit' value='Hinzufügen' onclick='add(".$item["id"]. ", anzahl)'/>
</form>
");
function add($id, $amount) {
echo "$amount of $id";
}
I used "echo" in the add function to see, if it works. But theres no output and no error message. How can this be fixed?