I want to store the session data into a session variable so that it can be used in another php page other than the action="addbill.php" in form.But the problem is i want to store the array name[] into the session variable but shows error.
<form action="addbill.php" method="POST">
<div id="dynamicInput">
<br><input type="text" name="name[]">
</div>
<input type="button" value="Add another text input" onClick="addInput('dynamicInput');">
<input type="submit"/>
</form>
<?php
session_start();
$_SESSION['addedmem']= $_POST['name'];
var_dump($_SESSION['addedmem']);
?>
<script>
var counter = 1;
var limit = 4;
function addInput(divName){
if (counter == limit) {
alert("You have reached the limit of adding " + counter + " inputs");
}
else {
var newdiv = document.createElement('div');
newdiv.innerHTML = "Entry " + (counter + 1) + " <br><input type='text' name='myInputs[]'>";
document.getElementById(divName).appendChild(newdiv);
counter++;
}
}
</script>
Output Error:Undefined index: name
"ANY HELP IS WELCOMED"