Jump to content

[SOLVED] Anyone know anything about php and wysiwyg working together?


djfox

Recommended Posts

Ok, here`s the situation.

 

The wysiwyg work great when adding new information into the database. However when it comes time to edit that information, it wants to be wonky. It will not customize the text colour, bold it or such similar things nor add in images. However it will do paragraphs.

 

Looking inside the actual database table, I am finding that the code, somewhere along the line, is adding in \ into the wysiwyg code where quotations are used and I believe this is where things are getting messed up. So I tried copying the codes used for inputing new data with the wysiwyg and use that for editing the already inputted wysiwyg data. Still, it wants to add those stupid \ and mess up the display.

 

How do I keep php from adding those \ in there?

 

Codes, in case they are needed:

admin_page_add.php (working)

<?php
//Date: November 20 2007
//For: A Place for Pets
//Description: Admin Panel

include("dbcon.php");
require_once "auth.php";

$Title = "A Place for Pets: Admin Panel: Page Creator";

require_once "header.php";
require_once "hidestatus.php";

if (!isLoggedIn()) {
Redirect("index.php");
}
?>

<table width=100% border=0 cellpadding=0><? //1
?>
<tr>
<td width=20% valign=top>
<? require_once "navbar.php"; ?>
<td>
<td>
<td>
<td width=80% valign=top>
<?php
if( $lev > {
?>
<script language="JavaScript" type="text/javascript" src="wysiwyg.js">
</script>
<table border=0 width=100% bgcolor="<? echo $outline; ?>"><? //2
?>
<tr>
<td bgcolor="<? echo $head; ?>"><font color="<? echo $font1; ?>"><b>Admin Panel: Page Creator</b></font>
</table> <? //2
?>
<form enctype="multipart/form-data" action="admin_page_add2.php" method="post">
<b>Page Title:</b>
<br><input type=text name="n" size=50 maxlength=255>
<p>
<b>Page Content:</b>
<br><textarea id="t" name="t" cols=80 rows=5 style="border: 0px; background-color:#000000; color: #B6ABCE;"></textarea>
<script language="javascript1.2">
  generate_wysiwyg('t');
</script>
<p>
<input type="submit" name="submit" value="Create Page">
</form>
<?php
}
else{
if ($lev < 9) {
header("Location: index.php");	
}
}
?>
</table><? //1
?>

<? require_once "footer.php"; ?>

 

admin_page_add2.php (working)

<?php
//Date: November 20 2007
//For: A Place for Pets
//Description: Admin Panel

include("dbcon.php");
require_once "auth.php";

$Title = "A Place for Pets: Admin Panel: Page Creator";

require_once "header.php";
require_once "hidestatus.php";

if (!isLoggedIn()) {
Redirect("index.php");
}
?>

<table width=100% border=0 cellpadding=0><? //1
?>
<tr>
<td width=20% valign=top>
<? require_once "navbar.php"; ?>
<td>
<td>
<td>
<td width=80% valign=top>
<?php
if( $lev > {
?>
<script language="JavaScript" type="text/javascript" src="wysiwyg.js">
</script>
<table border=0 width=100% bgcolor="<? echo $outline; ?>"><? //2
?>
<tr>
<td bgcolor="<? echo $head; ?>"><font color="<? echo $font1; ?>"><b>Admin Panel: Page Creator</b></font>
</table> <? //2
?>
<?php
$add="INSERT INTO apfp_page ( title, content ) VALUES ( '$n', '$t' )";
$res = mysql_query($add) or die(mysql_error());
header("Location: admin.php");
?>
<?php
}
else{
if ($lev < 9) {
header("Location: index.php");	
}
}
?>
</table><? //1
?>

<? require_once "footer.php"; ?>

 

admin_page_edit2.php (not working)

<?php
//Date: November 20 2007
//For: A Place for Pets
//Description: Page Editor

include("dbcon.php");
require_once "auth.php";

$Title = "A Place for Pets: Admin Panel: Page Editor";

require_once "header.php";
require_once "hidestatus.php";

if (!isLoggedIn()) {
Redirect("index.php");
}
?>

<table width=100% border=0 cellpadding=0><? //1
?>
<tr>
<td width=20% valign=top>
<? require_once "navbar.php"; ?>
<td>
<td>
<td>
<td width=80% valign=top>
<?php
if( $lev > {
?>
<script language="JavaScript" type="text/javascript" src="wysiwyg.js">
</script>
<table border=0 width=100% bgcolor="<? echo $outline; ?>"><? //2
?>
<tr>
<td bgcolor="<? echo $head; ?>"><font color="<? echo $font1; ?>"><b>Admin Panel: Page Editor</b></font>
</table> <? //2
?>
<?php
$res = mysql_query("SELECT id, title, content FROM apfp_page WHERE id=$id");
$page = mysql_fetch_row($res);
mysql_free_result($res);
?>
<form enctype="multipart/form-data" action="admin_page_edit3.php" method="post">
<b>Page Title:</b>
<br><input type=text name="n" size=50 maxlength=255 value="<? echo "$page[1]" ?>">
<p>
<b>Page Content:</b>
<br><textarea id="t" name="t" cols=80 rows=5 style="border: 0px; background-color:#000000; color: #B6ABCE;"><? echo $page[2] ?></textarea>
<script language="javascript1.2">
  generate_wysiwyg('t');
</script>
<p>
<input type="submit" name="submit" value="Edit Page">
</form>
<?php
}
else{
if ($lev < 9) {
header("Location: index.php");	
}
}
?>
</table><? //1
?>

<? require_once "footer.php"; ?>

 

admin_page_edit3.php (not working)

<?php
//Date: November 20 2007
//For: A Place for Pets
//Description: Page Editor

include("dbcon.php");
require_once "auth.php";

$Title = "A Place for Pets: Admin Panel: Page Editor";

require_once "header.php";
require_once "hidestatus.php";

if (!isLoggedIn()) {
Redirect("index.php");
}
?>

<table width=100% border=0 cellpadding=0><? //1
?>
<tr>
<td width=20% valign=top>
<? require_once "navbar.php"; ?>
<td>
<td>
<td>
<td width=80% valign=top>
<?php
if( $lev > {
?>
<script language="JavaScript" type="text/javascript" src="wysiwyg.js">
</script>
<table border=0 width=100% bgcolor="<? echo $outline; ?>"><? //2
?>
<tr>
<td bgcolor="<? echo $head; ?>"><font color="<? echo $font1; ?>"><b>Admin Panel: Page Editor</b></font>
</table> <? //2
?>
<?php
$add="UPDATE apfp_page (title,content) VALUES ('$n', '$t') WHERE id=$id";
$res = mysql_query($add) or die(mysql_error());
header("Location: admin.php");
?>
<?php
}
else{
if ($lev < 9) {
header("Location: index.php");	
}
}
?>
</table><? //1
?>

<? require_once "footer.php"; ?>

 

Refresher about everything I just typed in:

 

Problem:

The codes labeled (working) are functioning properly, there is nothing wrong with them. I posted them as comparison and to show that I did pretty much copy code for code for the (not working) to use. I did the copying because (working) is entering the data through a wysiwyg editor properly and the database shows the information is being inputted fine. The problem with (not working) is that when it is updating the data through the wysiwyg editor, it is entering \ when wysiwyg`s codes use quotations thus, preventing the data from being dispalyed properly.

 

Question:

How do I prevent those \ from appearing in the code when the (not working) files are being used?

Link to comment
Share on other sites

Ok, I did that and it still is not working.

 

I tried it in the page that displays the output information (that undid the code for everything, took that back out), I tried it in admin_page_edit2.php and that did not work either, and I placed it in admin_page_edit3.php and that still did not sole the problem. What it`s doing now is not entering the wysiwyg codes at all.

 

EDIT

I`m looking further into my code right now. Somehow, for some reason, the data isn`t being updated at all now. I`m going to solve that first, then try the strip tags again.

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.