Jump to content

FlatFile News Help


invisionx

Recommended Posts

I found this News script which is flatfile and well I want to add a name and date to it so that when I or one of my friends posts a new news post they can put there names on it can someone help me ill show both the form for the New Post News and for the save..

 

 

New Post

				<form action="<?=$_SERVER['PHP_SELF'] ?>" method="POST">
			Name: <input name="nname" type="text" size="25" maxlength="50">   <input name="date" type="text" value="<?php echo date("F j, Y, g:i a"); ?>" size="23" maxlength="100" readonly="true"><br>
			News: <textarea style="width:500px;height:150px" wrap=PHYSICAL name="text"></textarea> 
		</TD>
		<TD WIDTH=40></TD>	
		<TD WIDTH=110 align=right valign=middle>
			<input type=hidden name=action value="save" />
			<input type=hidden name=nr value="new" />
			<input style="width:100px" type="submit" value="Save" />
			</form>
			<form action="<?=$_SERVER['PHP_SELF'] ?>" method="POST">
			<input type=hidden name=action value="show" />
			<input style="width:100px" type="submit" value="Back" />
			</form>

 

Save

	if ( $action == 'save' || $save )
{
    $nname   = trim($nname);
	$text 	= trim($text);
	if (!empty($text))
	{ 	
		$text = ereg_replace("\\\'", "&#39;", $text);		// make the quotes visible ' --> &#039;
		$text = ereg_replace('\\\"', '"', $text); 			// remove escaping from doublequotes  \"
		$text = ereg_replace("\n", '<br>', $text); 			// linefeed / breakline ...

		($nr =='new')? $news[] = $text : $news[$nr] = $text;

		save_news();
	}

 

Thank you

invisionx

Link to comment
https://forums.phpfreaks.com/topic/58890-flatfile-news-help/
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.