I've been having a few issues with with my blog, when I try to submit an entry the data enters some fields and not others. [[ example // http://www.walkinginchrist.org/vintage/entry.php?id=22 ]] When I checked to see if it was being added to the database and it wasn't. I'm not sure exactly how to fix it and I was wondering if anyone could help me please? Thanks in advance!
submit.php
<?php
mysql_connect ('****', '****', '****');
mysql_select_db ('****')or die (mysql_error());
if (isset($_POST['submit'])) {
$month = htmlspecialchars(strip_tags($_POST['month']));
$date = htmlspecialchars(strip_tags($_POST['date']));
$year = htmlspecialchars(strip_tags($_POST['year']));
$time = htmlspecialchars(strip_tags($_POST['time']));
$title = htmlspecialchars(strip_tags($_POST['title']));
$entry = stripslashes($row['entry']);
$listening = stripslashes($row['listening']);
$reading = stripslashes($row['reading']);
$quote = stripslashes($row['quote']);
$entry = $_POST['entry'];
$timestamp = strtotime($month . " " . $date . " " . $year . " " . $time);
$category = (int)$_POST['category'];
$entry = nl2br($entry);
if (!get_magic_quotes_gpc()) {
$title = addslashes($title);
$entry = addslashes($entry);
}
$sql = "INSERT INTO blog (timestamp,title,category,listening,reading,quote,entry) VALUES ('$timestamp','$title','$category','$listening','$reading','$quote','$entry')";
$result = mysql_query($sql) or print ("Can't insert into table blog.<br />" . $sql . "<br />" . mysql_error());
if ($result != false) {
print "Your entry has successfully been entered into the database.";
}
mysql_close();
}
?>
<?php
$current_month = date("F");
$current_date = date("d");
$current_year = date("Y");
$current_time = date("H:i");
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<p><strong><label for="month">Date (month, day, year):</label></strong>
<select name="month" id="month">
<option value="<?php echo $current_month; ?>"><?php echo $current_month; ?></option>
<option value="January">January</option>
<option value="February">February</option>
<option value="March">March</option>
<option value="April">April</option>
<option value="May">May</option>
<option value="June">June</option>
<option value="July">July</option>
<option value="August">August</option>
<option value="September">September</option>
<option value="October">October</option>
<option value="November">November</option>
<option value="December">December</option>
</select>
<input type="text" name="date" id="date" size="2" value="<?php echo $current_date; ?>" />
<select name="year" id="year">
<option value="<?php echo $current_year; ?>"><?php echo $current_year; ?></option>
<option value="2004">2004</option>
<option value="2005">2005</option>
<option value="2006">2006</option>
<option value="2007">2007</option>
<option value="2008">2008</option>
<option value="2009">2008</option>
<option value="2010">2010</option>
</select>
<strong><label for="time">Time:</label></strong> <input type="text" name="time" id="time" size="5" value="<?php echo $current_time; ?>" /></p>
<?php
mysql_connect ('****', '****', '****') or die (mysql_error());
mysql_select_db ('****');
$result = mysql_query("SELECT * FROM blog_categories");
echo '<p><strong><label for="category">Category:</label></strong> <select name="category" id="category">';
while($row = mysql_fetch_array($result)) { ?>
<option value="<?php echo $row['category_id']; ?>"><?php echo $row['category_name']; ?></option>
<?php
}
?>
</select></p>
<p><strong><label for="title">Title of Post:</label></strong> <input type="text" name="title" size="40" /></p>
<p><strong><label for="title">Reading:</label></strong> <input type="text" name="reading" size="40" /></p>
<p><strong><label for="title">Listening:</label></strong> <input type="text" name="listening" size="40" /></p>
<p><strong><label for="title">Quote:</label></strong> <input type="text" name="quote" size="40" /></p>
<p><strong><label for="title">Entry:</label></strong><textarea cols="80" rows="20" name="entry" id="entry"></textarea></p>
<p><input type="submit" name="submit" id="submit" value="Submit"></p>
</form>
index.php
<?php include("/mnt/w0603/d08/s07/b025e6a3/www/vintage/cookiecheck.php");
include($headervar.$skin.$extension);
mysql_connect ('****', '****', '****') ;
mysql_select_db ('****');
$blog_postnumber = "3";
if(!isset($_GET['page'])){
$page = 1;
} else {
$page = $_GET['page'];
}
$from = (($page * $blog_postnumber) - $blog_postnumber); ?>
<div class="div" id="content">
<table width="337" border="0" cellspacing="0" cellpadding="2">
<tr>
<td colspan="2" valign="top"><p class="h4">. Salutations All</p></td>
</tr>
<tr>
<td valign="top"><img src="http://www.walkinginchrist.org/vintage/nav/1/images/welcome_avatar.gif" alt="welcome button"></td>
<td valign="top" class="div">Hello and welcome to Vintage Heart Online-- my online zine. Located here are my personal opinions on various subjects along with poems, short stories and personal graphics.<br><br>
Please feel free to browse the site, and link me if you wish. Please note that this Zine is not meant to be the ranting's of a Radical Leftist, but the unjudgemental, personal views of myself.<br>
<br>
<p align="right"><a href="#">What pray tell is a Zine ?</a></p></td>
</tr>
</table>
<?php
$sql = "SELECT * FROM blog ORDER BY timestamp DESC LIMIT $from, $blog_postnumber";
$result = mysql_query($sql) or print ("Can't select entries from table blog.<br />" . $sql . "<br />" . mysql_error());
while($row = mysql_fetch_array($result)) {
$date = date("l F d Y ( g:ia )", $row['timestamp']);
$id = $row['id'];
$title = stripslashes($row['title']);
$entry = stripslashes($row['entry']);
$listening = stripslashes($row['listening']);
$reading = stripslashes($row['reading']);
$quote = stripslashes($row['quote']);
if (strlen($entry) > 500)
{
$entry = substr($entry,0,500);
$entry = "$entry... <br /><br />";
}
?>
<br>
<table width="337" border="0" cellspacing="0" cellpadding="2">
<tr>
<td class="entryheader"><?php echo $title; ?></td>
</tr>
<tr>
<td class="entrysub"><?php echo $date; ?></td>
</tr>
<tr>
<td class="entrysub"><strong>Currently Reading:</strong> <?php echo $reading; ?></td>
</tr>
<tr>
<td class="entrysub"><strong>Currently Listening To:</strong> <?php echo $listening; ?></td>
</tr>
<tr>
<td class="entrysub"><strong>Quote:</strong> <?php echo $quote; ?></td>
</tr>
<tr>
<td class="entry"><?php echo $entry; ?></td>
</tr>
<tr>
<td class="entryfooter"> <div align="right">
<?php
$result2 = mysql_query ("SELECT id FROM blog_comments WHERE entry='$id'");
?>
<?php if ($num_rows > 0) {
echo "<a href=\"entry.php?id=" . $id . "\">Read More?</a> | <a href=\"entry.php?id=" . $id . "\">" . $num_rows . "Comments</a>";
}
else {
echo " <a href=\"entry.php?id=" . $id . "\">Read More?</a> | <a href=\"entry.php?id=" . $id . "\"> Leave a comment ?</a>";
} ?>
</div>
</td>
</tr>
</table>
<?php
}
$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM blog"),0);
$total_pages = ceil($total_results / $blog_postnumber);
if($page > 1){
$prev = ($page - 1);
echo "<a href=\"index.php?page=$prev\"><< Newer</a> \n";
}
for($i = 1; $i <= $total_pages; $i++){
if($page == $i){
echo "$i \n";
} else {
echo "<a href=\"index.php?page=$i\">$i</a> \n";
}
}
if($page < $total_pages){
$next = ($page + 1);
echo "<a href=\"index.php?page=$next\">Older >></a>\n";
}
?>
<?php
?>
</div>