Lysine
28-01-2007, 08:37 PM
I want to add news catergories into this news script. I want it so i click UK News and the uk news will show.
<?
ob_start(); # Allows Cookies
include("config.php");
if($logged[username] && $logged[level] == 12 || $logged[level] == 9){
switch($_GET[action]){
default:
echo("<b><u>Add News</b></u><br>Here you can add news to Thishabbo. Please only post news, and make sure the image url is correct, and check it once you have posted it");
echo("<form method=\"post\" action=\"addnews.php?action=submit_news\">
Title:<br>
<input type='text' size='30' name='title'>
<br>
<br>
Image URL:<br>
<input type='text' size='30' name='image'><br><br>
News Story: (Simple HTML Allowed eg. Bold, Underline, Italic)<br>
<textarea name=\"content\" cols='80' rows='10'></textarea>
<br>
<input type=\"submit\" value=\"Submit Article\"></form>");
break;
case 'submit_news':
$author = $logged[username];
$date = $date = date("j F");
$title = $_POST[title];
$image = $_POST[image];
$contents = $_POST[content];
if($title==NULL||$image==NULL||$content==NULL){
echo("<meta http-equiv=\"Refresh\" content=\"2; URL=addnews.php\"/>You have left a field blank<br><br><b>Please Wait...</b>");
}else{
$sql=("INSERT INTO `news` (id, date, author, title, content, image)VALUES('', '$date', '$author', '$title', '$contents', '$image')");
$result = mysql_query($sql) or die ('Error during the execution of the MySQL query : ' . mysql_error());
echo("<meta http-equiv=\"Refresh\" content=\"2; URL=viewnews.php\"/>Your News Article has successfulyl been submitted!<br><br><b>Please Wait...</b>");
}
break;
}
}else{
echo("You need to be Admin or a Manager to view this!");
}
?>
+ rep if you can help.
<?
ob_start(); # Allows Cookies
include("config.php");
if($logged[username] && $logged[level] == 12 || $logged[level] == 9){
switch($_GET[action]){
default:
echo("<b><u>Add News</b></u><br>Here you can add news to Thishabbo. Please only post news, and make sure the image url is correct, and check it once you have posted it");
echo("<form method=\"post\" action=\"addnews.php?action=submit_news\">
Title:<br>
<input type='text' size='30' name='title'>
<br>
<br>
Image URL:<br>
<input type='text' size='30' name='image'><br><br>
News Story: (Simple HTML Allowed eg. Bold, Underline, Italic)<br>
<textarea name=\"content\" cols='80' rows='10'></textarea>
<br>
<input type=\"submit\" value=\"Submit Article\"></form>");
break;
case 'submit_news':
$author = $logged[username];
$date = $date = date("j F");
$title = $_POST[title];
$image = $_POST[image];
$contents = $_POST[content];
if($title==NULL||$image==NULL||$content==NULL){
echo("<meta http-equiv=\"Refresh\" content=\"2; URL=addnews.php\"/>You have left a field blank<br><br><b>Please Wait...</b>");
}else{
$sql=("INSERT INTO `news` (id, date, author, title, content, image)VALUES('', '$date', '$author', '$title', '$contents', '$image')");
$result = mysql_query($sql) or die ('Error during the execution of the MySQL query : ' . mysql_error());
echo("<meta http-equiv=\"Refresh\" content=\"2; URL=viewnews.php\"/>Your News Article has successfulyl been submitted!<br><br><b>Please Wait...</b>");
}
break;
}
}else{
echo("You need to be Admin or a Manager to view this!");
}
?>
+ rep if you can help.