Peter Shadeslayer
New member
More problems. T_T
I don't think I really need to explain the purpose of the code... it's pretty direct. ;D
PHP:
//Insert an update
function inUpdate($title, $update)
{
$user = "Zack";
$query = "INSERT INTO updates (title, update, date, user)
values('" . $title . "', '" . $update . "', CURDATE(), '" . $user . "')";
mysql_query($query) or die(mysql_error());
}
?>
PHP:
<?php
include("functions.php");
databaseConnect("mysql.owensvilleumc.com", "username", "******", "dbname");
$title = $_POST['title'];
$update = $_POST['update'];
if(isset($title))
{
cleanString($title);
$okay++;
}
else
{
echo "You left the title field blank! ";
}
if(strlen($title) > 50)
{
echo "Your title cannot be longer than fifty characters. ";
}
else
{
$okay++;
}
if(isset($update))
{
cleanString($title, $update, $_COOKIE['user']);
$okay++;
}
else
{
echo "You left the update field blank! ";
}
if(strlen($update) > 500)
{
echo "The length of an update cannot exceed 500 characters. ";
}
else
{
$okay++;
}
if($okay == 4)
{
inUpdate($title, $update);
}
else
{
echo "something's up...";
}
?>
<form action="cms.php" method="post">
<table>
<tr>
<td>
Update Title:
</td>
<td>
<input type="text" name="title">
</td>
</tr>
<tr>
<td>
Update:
</td>
<td>
<textarea name="update">
</textarea>
</td>
</tr>
<tr>
<td>
<input type="reset" value="Clear">
</td>
<td>
<input type="submit" value="Submit">
</td>
</tr>
</table>
</form>
I don't think I really need to explain the purpose of the code... it's pretty direct. ;D