Can I add this code:
if (!isset ($preview)) {
$preview = '0';
}
if (isset ($_POST["submit_add"])) {
$preview = '0';
$date_input = @gmdate('YmdHi', time() + (3600 * 2));
$query = "INSERT INTO weblog VALUES ('','$title_input','$text_input','$date_input','$loggedin_id','$submitted')";
$exec = mysql_query($query);
echo '<script>location.href="index.php"</script>';
}
else {
if (!isset ($title_input) OR !isset ($text_input)) {
$title_input = "";
$text_input = "";
}
$title_input = ereg_replace( "['\"\]", "", $title_input);
$text_input = ereg_replace( "['\"\]", "", $text_input);
include "logo.php";
echo "<title>Weblog - Add item</title>
<div id='main'>
<form method=post action='customcpgpage.php?preview=1'>
<table cellspacing=0 cellpadding=0 width=100%>
<tr>
<td class='header'>
<b>Add item</b>
</td>
</tr>
<tr>
<td class='weblog'>
<table>
<tr>
<td class='form'>
title:
</td>
<td class='form'>
<input name=title_input type=text value='$title_input' size=30 maxlength=25>
</td>
</tr>
<tr>
<td class='form'>
text:
</td>
<td class='form'>
<textarea name=text_input>$text_input</textarea>
</td>
</tr>
</table>
<input name=submit_preview type=submit value=preview>
</td>
</tr>
</table>
</form>
";
}
if ($preview == '1') {
if ($title_input != "" AND $text_input != "") {
$preview_date = get_date_long(@gmdate('YmdHi', time() + (3600 * 2)));
$preview_text = ubb_advanced(ubb_basic(nl2br(htmlspecialchars($text_input))));
echo "<form method=post action='customcpgpage.php'>
<table cellspacing=0 cellpadding=0 width=100%>
<tr>
<td class='header'>
<b>$title_input</b>
</td>
</tr>
<tr>
<td class='weblog'>
<b>$preview_date</b> posted by <a href=''>$loggedin_name</a>
<hr>
$preview_text<br><br>
<input name=title_input type=hidden value='$title_input'>
<input name=text_input type=hidden value='$text_input'>
<input name=submitted type=hidden value='0'>
<input name=submit_add type=submit value=submit>
</td>
</tr>
</table>
</form>
";
}
else {
echo "<table cellspacing=0 cellpadding=0 width=100%>
<tr>
<td class='header'>
<b>Error</b>
</td>
</tr>
<tr>
<td class='weblog'>
Both fields are required.
</td>
</tr>
</table>
";
}
}
Into that function?
function myfunction()
{
print "How much PHP do you need?";
}