Jump to content

Session Array Push


edd12345678

Recommended Posts

Hi Guys,

 

I am having a small problem with an array.

 

I want to push information from a form into an array.

 

However each time I do it it just replaces the last entry in the array with the information in stead of adding a new value to the array.

 


<?php

				// if generate is pressed
				if(isset($_POST['generate'])){

					// get values from form
					$name = htmlspecialchars($_REQUEST['add']);
					array_push($stack, $name);

					print_r($stack);
					}
					?>

 

Can anybody help?

 

Thanks

 

Ed

Link to comment
https://forums.phpfreaks.com/topic/253169-session-array-push/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.