| You need to add your array to a session variable or some other permanent storage system, because PHP is without state. Additionally, you aren't really cuing the array to expand on post.
<?
session_start();
if(!isset($_SESSION['dAta'])) {
$_SESSION['dAta'] = array("961204","961205","961206");
}
if(isset($_POST['submit'])) {
$arr = $_SESSION['data'];
$arr[] = $_POST['field1'];
$_SESSION['dAta'] = $arr;
print_r($_SESSION['dAta'];
}
?>
<form method="post">
<input id="field1" name="field1" type="text" size="80" value="<? echo $_POST['field1']; ?>" />
<input type="submit" id="submit" name="submit" value="ENTER" />
</form>
Anyplace you want to use the session variable, make sure you have session_start() at the top of that page. |