PHP Associate array populated by form input -
i need populate associative array form input. each time user clicks submit runs php script, redirects them form in can add key value pair array.
<form action="submit.php" method="post" name="form-one"> <input type="text" name="name"> <input type="text" name="id"> <button type="submit">submit</button> </form> <?php //add input vales associative array dynamically ?>
so each time form gets processed, need name , id saved in key value pair, adding on previous 1 saved.
well, bit trickier, php script executed every time form passed , terminated. persist previous data somewhere, database, or serialize file, read file on execution, , append newest entry on top of that.
another way of going using sessions. store array in session variable e.g. $_session['array']
, , append each time form gets processed.
Comments
Post a Comment