View Single Post
  #1 (permalink)  
Old 11-24-2006, 05:57 PM
dejan99 dejan99 is offline
Member
 
Join Date: Jan 2007
Posts: 80
dejan99 is on a distinguished road
PHP - saving results from new array entry - PHP ?

OBJECTIVE: When a visitor goes to index.php and clicks the enter button, it will add the input from "field1" into the $dAta array. AND, this is the most important, it will save the entries into the $dAta array.

CURRENT: This is the code that i have for now. When i type something into "field1" and click enter, i see the new entry into the array with the print_r. But when i exit and go back to open the index.php the added entry is not there.

THEORY: Any ideas??? Does this require the use of f.open, f.write. f.close? Im thinking something along the lines of scanning the existing array into a temporary array, add then entry from field 1, then write the new array to a new php file? Thanks.

---------CODE SECTION BELOW----------
<?php
$dAta = array(1 => "961204","961205","961206",);
?>

<FORM METHOD="POST" ACTION="index.php">
<input name="field1" type="text" size="80" value="">
<INPUT TYPE=submit VALUE="Enter">

<?php
$dAta[] = $_POST[field1];
print_r($dAta);
?>

Reply With Quote