This question already has an answer here:
For some reason, whenever I try to add something to my array, it just overwrites the index 0, rather than goingto index 1, 2 etc...
Here's my code
//Saved names
session_start();
$saved_names = array();
$_SESSION['saved_names'] = $saved_names;
if($_GET['saved_name']){
$saved_name = $_GET['saved_name'];
$saved_names[] = $saved_name;
}
echo '<pre>', print_r($saved_names, true), '</pre>';
</div>