Hello,
I'm using a form to update info in the db. When user submits form, I want the data to be updated in the database, and I want the updated content to appear on form's action page. If I submit, I can get the content to appear in the page, but I can't get the db to update. Any ideas what I'm messing up here?
<?php
include("../php_includes/settings.inc.php");
$connect = mysql_connect ($hostname, $username, $password);
if (isset($POST['content'])) {
$codeContent = $POST['content'];
$codeContent = str_replace('<TEXTFORMAT LEADING=\"2\">', "", $codeContent);
$codeContent = str_replace('</TEXTFORMAT>', "", $codeContent);
$codeContent = str_replace("_sans", "sans-serif", $codeContent);
$codeContent = str_replace('SIZE=\"9\"', "SIZE=\"1\"", $codeContent);
$codeContent = str_replace('SIZE=\"12\"', "SIZE=\"2\"", $codeContent);
$codeContent = str_replace('SIZE=\"14\"', "SIZE=\"3\"", $codeContent);
$codeContent = str_replace('SIZE=\"16\"', "SIZE=\"4\"", $codeContent);
$codeContent = str_replace('SIZE=\"18\"', "SIZE=\"5\"", $codeContent);
$codeContent = str_replace('SIZE=\"22\"', "SIZE=\"6\"", $codeContent);
$codeContent = str_replace('>', ">\n", $codeContent);
$codeContent = str_replace('<', "\n<", $codeContent);
$codeContent = str_replace(''', "'", $codeContent);
echo stripslashes($codeContent);
$sql = "UPDATE content1 SET content1_1='$codeContent' WHERE id='1'";
$result = mysql_db_query($database,$sql,$connect);
}
//Error Checking
if (mysql_db_query ($database, $sql, $connect)) {
/ Let's replace this line with an HTML page, or send the form to itself /
print ("Great, you've completed Step #2. You can see your updated content below. You're almost done. Now it's time to choose your music and images.");
}
else {
print ("Sorry, information not updated. Contact Webmaster.");
}
mysql_close($connect);
?>