Jump to content

New Help -- Shoud be easy


xtremeone

Recommended Posts

I am using this small basic script that prints WHAT I want but does not display it HOW I want it.

 

Let me explain: Heres the script

 

<html>

<head></head>

<body>

<?php

$page = $_POST["category"];

$name = $_POST["name"];

$title = $_POST["title"];

$content = $_POST["content"];

$date = date('m-d-y H:i:s');

 

 

print("<b>Thank You!</b><br />Your information has been added! You can see it by <a href=$page>Clicking Here</a>");

$out = fopen("$page", "a+");

if (!$out) {

print("Could not append to file");

exit;

}

fputs ($out,implode,("\n"));

fwrite($out,"<table width=\"560\" cellpadding=\"0\" cellspacing=\"0\">

<td width=\"560\" height=\"1\" bgcolor=\"#000000\" colspan=\"5\"></td>

<tr>

<td width=\"1\" height=\"25\" bgcolor=\"#000000\"></td><td width=\"380\" height=\"25\" bgcolor=\"#C0C0C0\"> <Font color=\"#FFFFFF\" face=\"Verdana\" size=\"2\"><B>$title</B></Font> $date</td><td width=\"1\" height=\"25\" bgcolor=\"#000000\"><td width=\"180\" height=\"25\" bgcolor=\"#C0C0C0\"> By: $name</td><td width=\"1\" height=\"25\" bgcolor=\"#000000\"></td>

</tr>

<tr>

<td width=\"500\" height=\"1\" bgcolor=\"#000000\" colspan=\"5\"></td>

</tr>

<tr>

<td width=\"560\" colspan=\"5\">

<table cellpadding=\"0\" cellspacing=\"0\">

<td width=\"1\" height=\"25\" bgcolor=\"#000000\"></td><td width=\"560\" bgcolor=\"#E6E6CC\"><Font color=\"#808080\"> $content</Font></td><td width=\"1\" height=\"25\" bgcolor=\"#000000\"></td>

</table>

</td>

</tr>

<tr>

<td width=\"560\" height=\"1\" bgcolor=\"#000000\" colspan=\"5\"></td>

</tr>

</table><br>");

fclose($out);

?>

 

</body>

</html>

 

 

 

Pretty basic....no?? There is another file that just has a form on it that when you choose a category that is the page that is created and is written to using the varibles in that form.

 

Heres the question:

 

How do I print this info to a TEXT FILE so that it gets sorted by the most recent date when viewed....basically the opposite from what it is doing now. The script writes to a text file but loops down (the latest date is at the bottom). I want it to do the opposite and print the latest date at the top of the text file ?? Reverse order !

 

Easy to you guys....Im sure....easy to me......not so much!!

 

Also how do I write a script that will count the number of dates that have been written to a file so that I can display a tally of items that have been written to a text file ?? Is this possible ??

 

Thanks alot Guys/Gals~

 

Link to comment
https://forums.phpfreaks.com/topic/96667-new-help-shoud-be-easy/
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.