This is the script to write to the file:
Code: Select all
<?php
$name = $_POST['name'];
$des = $_POST['des'];
$content = "$name|$des\n";
$file = fopen("infolist.php", "r");
$read = fread($file, filesize("infolist.php"));
fclose($file);
$blah = fopen("infolist.php", "w");
$news=stripslashes($news);
fwrite($blah, "$content $read");
fclose ($blah);
print "<a href=\"../../index.php?id=4\">Back</a>";
?>Code: Select all
<?php
$data = file('proe/info/infolist.php');
$data = array_reverse($data);
foreach($data as $element) {
$element = trim($element);
$pieces = explode("|", $element);
echo "<div class=\"mainDiv\" state=\"0\"><div class=\"topItem\" classOut=\"topItem\" classOver=\"topItemOver\" onMouseOver=\"Init(this);\" ><font face=\"geneva\" size=\"2px\" color=\"#000000\"> $pieces[0] - <a href=\"proe/info/delete.php?name=$pieces[0]\">Delete</a></font></div><div class=\"dropMenu\" ><div class=\"subMenu\" state=\"0\"><span class=\"subItem\" classOut=\"subItem\" classOver=\"subItemOver\"><font face=\"geneva\" size=\"2px\" color=\"#000000\"> $pieces[1] </font></span></div></div>";
}
?>Is there a better way of writing the data to a new line?