Hi all, NEW NOVICE to php..... I need a very simple flatfile DB that has 4 fields and about 20 rows like so: datefrom || dateto || availability || price basically I need these fields to be 'editable' by the administrator but I want them in a table Anyone any ideas how I can have this as a flatfile db, editable and saved again? Thanks I found something like this...... <? $Lines = file("data.txt"); foreach($Lines as $Key => $Val) { //explode that data into a new array: $Data[$Key] = explode("||", $Val); } for($K = 0; $K < sizeof($Lines); $K++) { echo '<p>'; echo 'Name: '.$Data[$K][0].'<br>'; echo 'Age: '.$Data[$K][1].'<br>'; echo 'Hobby: '.$Data[$K][2].'<br>'; echo '</p>'; } ?> PHP:
1. Use a loop to generate a tabulated form with the help of the ff-db. Let the names of the input elements be associative arrays such <input type="text" name="customer[1][datefrom]"> <input type="text" name="customer[1][dateto]"> <input type="text" name="customer[1][availability]"> <input type="text" name="customer[1][prince]"> <input type="text" name="customer[2][datefrom]"> <input type="text" name="customer[2][dateto]"> <input type="text" name="customer[2][availability]"> <input type="text" name="customer[2][prince]"> <input type="text" name="customer[3][datefrom]"> <input type="text" name="customer[3][dateto]"> <input type="text" name="customer[3][availability]"> <input type="text" name="customer[3][prince]"> Code (markup): Note: i have used the table markup above to keep it simple! 2. Now when teh form is submitted loop the $_POST["customer"] associative array, make lines from its new children arrays and write it to the file.