Avatar of axessJosh
axessJosh

asked on 

add input values to array each time user hits submit

I am trying to create a temporary list to display before it submits to my DB.

I want to create an array of values the user is submitting, and have that displayed when the user hits submit, and have each subsequent value added as the user inputs and sends.

I have it working to update and display, but I can't figure out how to get it to keep the value and add new.


any suggestions?
<fieldset><legend>Enter Contributor</legend>
<form action="" method="post">
<input type="input" name="name"> Name <input name="submit" type="submit">
</form>
</fieldset>

<?php if(isset($_POST['submit'])) {
	$_SESSION['names'] = $_POST['name'];
	
} ?>

<?php echo $_SESSION['names']; ?>

Open in new window

PHP

Avatar of undefined
Last Comment
ghodder

8/22/2022 - Mon