Jump to content

PHP and WYSIWUG


George Botley

Recommended Posts

Hi,

 

I have created a CMS system but it doesn't like the WYSIWUG...

 

How can i get the PHP to actually process the HTML content that is posted from the WYSIWUG into a database table, and to second that, how can I get it to update the WYSIWUG data that exists on a pages record.

 

Please help, as the client is getting annoyed...

 

Require any of my written scripts? - Just ask..

Link to comment
Share on other sites


<? 

/* Include Configuration Files */
include_once "../config/config.php";

//Edit Page
$edit = $_GET["edit"];

if("yes" == $edit) {	

/* Update Page within database. */

$year = date('Y');
$month = date('m');
$day = date('d');

$con = mysql_connect("$server","$dbuser","$dbpass");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("$database", $con);

$id = $_POST["id"];
$title1 =  $_POST["title"];
$content1 =  $_POST["website_content"];
$visible =  $_POST["visible"];

mysql_query("UPDATE ap_pages SET title = '$title1' WHERE id LIKE '$id'");
mysql_query("UPDATE ap_pages SET content = '$content1' WHERE id LIKE '$id'");
mysql_query("UPDATE ap_pages SET dateedit = '$year-$month-$day' WHERE id LIKE '$id'");
mysql_query("UPDATE ap_pages SET visible = '$visible' WHERE id LIKE '$id'");

mysql_close($con);

echo '<div class="alertsuccess_info">
<strong>Page Modified Successfully</strong> - Your changes have taken effect immeadiately. 	</div>';
echo "<meta http-equiv='refresh' content='3;url=index.php?ToDo=WebsiteContent/ViewPages' />";

}

elseif("yes" != $edit) {	

$con = mysql_connect("$server","$dbuser","$dbpass");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("$database", $con);

$pageid = $_GET["id"];

$result = mysql_query("SELECT * FROM ap_pages WHERE id = '$pageid'");

while($row = mysql_fetch_array($result))
  {
  $id = $row['id'];
  $title1 = $row['title'];
  $content = $row['content'];
  $date = $row['date'];
  $date1 = $row['dateedit'];
  $visible = $row['visible'];
  }
  
}

?>

 

My apologies....

 

By looking above I can't see any errors... can you?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.