Psybadek
06-10-03, 07:53 PM
Ok, Im having trouble inserting.
Heres the form page..
if ($s == 'addnews'){
include 'config.php';
include 'global.php';
?>
<head>
<style type='text/css'>
/* Main styles for 3B */
body {
scrollbar-face-color: #7f8e9b;
scrollbar-shadow-color: #eeeeee;
scrollbar-highlight-color: #eeeeee;
scrollbar-3dlight-color: #000000;
scrollbar-darkshadow-color: #000000
scrollbar-arrow-color: #000000
}
/* Main styles everything else inheirts from these */
body { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px }
tr, td, table { font-family: Verdana, Arial, Helvetica, sans-serif }
/* Header Styles */
.headermain { font-family: Verdana, Arial, Helvetica, sans-serif; color: #000000; font-size: 10px; background-color: #336699; }
.headermain2 { font-family: Verdana, Arial, Helvetica, sans-serif; color: #000000; font-size: 10px; background-color: #eeeeee; }
.headermain3 { font-family: Verdana, Arial, Helvetica, sans-serif; color: #ffffff; font-size: 10px; background-color: #336699; }
</style>
</head>
<?
include 'nav.php';
?>
<td width="60%">
<table border="0" cellpadding="1" cellspacing="1" bgcolor="#000000" width="100%">
<tr>
<td class="headermain3" width="100%">
<b>Add News
</td>
</tr>
<tr>
<form action="admincp.php?s=newssubmit1" method="post">
<td class="headermain2" width="100%">
<?
$news = mysql_query("SELECT * FROM al_news");
while ($row = mysql_fetch_array($news)) {
$id = $row['id'];
$subject = $row['subject'];
$author = $row['author'];
$content = $row['content'];
$source = $row['source'];
}
?>
Name: <input type=text name="name"><br>
Subject: <input type=text name="subject"><br>
Author: <input type=text name="author"><br>
Source: <input type=text name="source"><br>
Date: <input type=text name="date" value="<? print(date("F d, Y, h:i")); ?>"><br>
Content: <textarea cols="10" rows="5" name="content"></textarea><br>
<input type=submit value="Submit">
</td>
</form>
</tr>
</table>
<td width="20%" valign="top">
<table border="0" cellpadding="1" cellspacing="1" bgcolor="#000000" width="100%">
<tr>
<td class="headermain3" width="100%">
<b>Latest News</b>
</td>
</tr>
<tr>
<td class="headermain2" width="100%">
</td>
</tr>
</table>
</td>
<br>
</td>
</tr>
</table>
<br>
<center>
<?
footer()
?>
</center>
<?
}
and the rest to where i insert in DB
if ($s == 'newssubmit1') {
include 'config.php';
mysql_query("INSERT INTO al_news WHERE name = '$name', subject = '$subject', date = '$date', content = '$content', author = '$author', source = '$source'");
print "News successfully Inserted!<br>";
print "<a href=\"admincp.php\">Click Here</a> to return to the admincp.";
}
?>
what am i doing wrong?
Heres the form page..
if ($s == 'addnews'){
include 'config.php';
include 'global.php';
?>
<head>
<style type='text/css'>
/* Main styles for 3B */
body {
scrollbar-face-color: #7f8e9b;
scrollbar-shadow-color: #eeeeee;
scrollbar-highlight-color: #eeeeee;
scrollbar-3dlight-color: #000000;
scrollbar-darkshadow-color: #000000
scrollbar-arrow-color: #000000
}
/* Main styles everything else inheirts from these */
body { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px }
tr, td, table { font-family: Verdana, Arial, Helvetica, sans-serif }
/* Header Styles */
.headermain { font-family: Verdana, Arial, Helvetica, sans-serif; color: #000000; font-size: 10px; background-color: #336699; }
.headermain2 { font-family: Verdana, Arial, Helvetica, sans-serif; color: #000000; font-size: 10px; background-color: #eeeeee; }
.headermain3 { font-family: Verdana, Arial, Helvetica, sans-serif; color: #ffffff; font-size: 10px; background-color: #336699; }
</style>
</head>
<?
include 'nav.php';
?>
<td width="60%">
<table border="0" cellpadding="1" cellspacing="1" bgcolor="#000000" width="100%">
<tr>
<td class="headermain3" width="100%">
<b>Add News
</td>
</tr>
<tr>
<form action="admincp.php?s=newssubmit1" method="post">
<td class="headermain2" width="100%">
<?
$news = mysql_query("SELECT * FROM al_news");
while ($row = mysql_fetch_array($news)) {
$id = $row['id'];
$subject = $row['subject'];
$author = $row['author'];
$content = $row['content'];
$source = $row['source'];
}
?>
Name: <input type=text name="name"><br>
Subject: <input type=text name="subject"><br>
Author: <input type=text name="author"><br>
Source: <input type=text name="source"><br>
Date: <input type=text name="date" value="<? print(date("F d, Y, h:i")); ?>"><br>
Content: <textarea cols="10" rows="5" name="content"></textarea><br>
<input type=submit value="Submit">
</td>
</form>
</tr>
</table>
<td width="20%" valign="top">
<table border="0" cellpadding="1" cellspacing="1" bgcolor="#000000" width="100%">
<tr>
<td class="headermain3" width="100%">
<b>Latest News</b>
</td>
</tr>
<tr>
<td class="headermain2" width="100%">
</td>
</tr>
</table>
</td>
<br>
</td>
</tr>
</table>
<br>
<center>
<?
footer()
?>
</center>
<?
}
and the rest to where i insert in DB
if ($s == 'newssubmit1') {
include 'config.php';
mysql_query("INSERT INTO al_news WHERE name = '$name', subject = '$subject', date = '$date', content = '$content', author = '$author', source = '$source'");
print "News successfully Inserted!<br>";
print "<a href=\"admincp.php\">Click Here</a> to return to the admincp.";
}
?>
what am i doing wrong?