I know I may be looking over something small and simple...but I am frustrated.
<?php
$content_title = 'Home Page Administration';
$page_title = 'Index Page Options';
include( '../includes/adminheader.html' );
include_once( '../includes/dbconnect.php' );
// Create a function for escaping the data.
function escape_data ($data) {
// Need the connection.
global $dbc;
if (ini_get('magic_quotes_gpc')) {
$data = stripslashes($data);
}
return mysql_real_escape_string($data);
} // End of function.
if( isset( $_POST['action']) == 'Submit Info' ) { //Handle the form
//Create a blank variable
$message = NULL;
//Check for content title
if( empty( $_POST['title'] )) {
$t = FALSE;
$message .= '<p>You need to title your post</p>';
} else {
$t = escape_data( $_POST['title'] );
}
//Check for content to be submitted.
if( empty( $_POST['content'] )) {
$c = FALSE;
$message .='<p><font color="red">You can\'t display a blank home page!!</font></p>';
} else {
$c = escape_date( $_POST['content'] );
}
//Check for an image to be posted.
if( empty( $_POST['img'] )) {
$i = FALSE;
$message .='<p><font color="red">You can\'t have a missing image</font></p>';
} else {
$i = $_POST['img'];
}
//Check for img description
if( empty( $_POST['imgdesc'] )) {
$imgdesc = FALSE;
$message .='<p><font color="red">We need a description for this image!!</font></p>';
} else {
$imgdesc = escape_data( $_POST['imgdesc'] );
}
//Check for date to display
if( empty( $_POST['datetodisplay'] )) {
$dm = FALSE;
$message .= '<p><font color="red">When do you want this to display?</font></p>';
} else {
$dm = $_POST['datetodisplay'];
}
if( $t && $c && $i && $imgdesc && $dm )
{
$sql = "INSERT INTO indexpage
( title, content , datemod , img , imgdesc , datetodisplay )
VALUES
( '$t', '$c', now(), '$i', '$imgdesc', '$dm' )";
$result = @mysql_query( $sql );
echo '<p>Your changes have been added</p>';
}
//Print the messge if there is one
if( isset( $message )) {
echo '<font color=\"red\">' . $message . '</font>';
}
}
?>
<form action="adminhome.php" method="POST">
<table width="100%">
<tr>
<td>Title your post<br /><small>IE. The date of the post</small></td>
<td><input type="text" name="title" /></td>
</tr>
<tr>
<td valign="top">Enter content to be displayed on home page:</td>
<td><textarea cols="25" rows="10" name="content"></textarea></td>
</tr>
<tr>
<td>Is there an image to be displayed?</td>
<td><input type="file" name="img" /></td>
</tr>
<tr>
<td>Image description<br /><small>What will be printed for the "ALT" tag</small></td>
<td><input type="text" name="imgdesc" /></td>
</tr>
<tr>
<td>Date to display as home page</td>
<td><input type="text" name="datemod" /></td>
</tr>
<tr align="left">
<td colspan="2"><?php printf ("Updated records: %d\n", mysql_affected_rows()); ?></td>
</tr>
<tr>
<td colspan="2">
<div align="center"><input type="submit" name"action" value="Submit Info" /></div>
</td>
</tr>
</table>
</form>
<?php
include( '../includes/footer.html' );
?>
What could I be missing??