<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Add News</title>
</head>
<body>
<h1>Add News</h1>
<form method="post" action="<?php $_SERVER['PHP_SELF']?>">
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td>Name</td>
<td><input type="text" name="txtAuthor" /></td>
</tr>
<tr>
<td>News</td>
<td><textarea name="txtContent" cols="60" rows="5"></textarea></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="Submit" /></td>
</tr>
</table>
</form>
</body>
</html>
<?php
if($_POST['Submit'])
{
if(!empty($_POST['txtAuthor']) && !empty($_POST['txtContent']))
{
include ('../NewsScript.php');
$news = new NewsScript();
/**
* notice we don't deal with bad input here,
* the NewsScript object does this for us using our clean() function
*/
$news->addNews($_POST['txtAuthor'], $_POST['txtContent']);
}
else
{
echo "Please complete the form.";
}
}
?>
|