I'm trying to submit a form along with the "First" & "Last" name, when the form is submitted, How do I insert those new names into the existing array starting with a comma (so the PHP file doesn't break with white blank space).
I've tried this several times, but no use at all.
This is the PHP file called: "Arrays.php"
<?php
$array_demo = array
(
// list of peoples names
'John' => 'Wright'
);
?>
This is the HTML form called: index.php
<form action="" method="POST">
<input type="text" name="firstname"><br>
<input type="text" name="lastname"><br>
<button type="submit">Add Names</button>
</form>
Any suggestions fellow StackOverflow Members? Trying to add those submitted-form fields inside an existing array as shown above.