Jump to content

Recommended Posts

I am using this great WYSIWYG editor from http://koivi.com/WYSIWYG-Editor/ it does all that I need. However it outputs the edited data like this

 

<?php echo nl2br(htmlentities($_POST['editor1_content'])); ?>

 

How can I take the data and produce a variable? If i try the obvious way

<?php $variable= nl2br(htmlentities($_POST['editor1_content'])); ?>

It give me a whitespace error? I have no idea what nl2br or htmlentites does to the $_POST however I am sure I need them for the data to be properly transferred to the mysql database. (That is the whole reason behind producing a variable.)

 

**Edit: I looked up in the php manual to see what nl2br and htmlentities were used to accomplish. It is now extremely important to me that their functionality for converting things into html be included in database entry.

 

Is there a way to produce their output assigned to a variable? **

Link to comment
https://forums.phpfreaks.com/topic/115665-solved-wysiwyg-editor-out-put-question/
Share on other sites

you may have a weird character in your code

copy your code into notepad, then copy it from notepad and paste it back in,

 

heres some working code

<form method="POST">
<input type="text" name="editor1_content">
<input type="submit" name="submit">
</form>
<?php
if(isset($_POST['submit']))
{
$variable= nl2br(htmlentities($_POST['editor1_content']));
echo $variable;
}
?>

nl2br(htmlentities($_POST['editor1_content']));

 

I apologize I am too drowsy... I was doing this

 

$variable= "nl2br(htmlentities($_POST['editor1_content']))";

 

which was giving me the whitespace error.. I noticed it after you guys had recommended that i echo it.. thank you for your time sorry.. I hate being the guy who always makes the stupid mistakes! :-X

 

** edit: If some one else searches this later take out the quotations just assign the variable like so

$variable= nl2br(htmlentities($_POST['editor1_content']));

while painfully obvious.. maybe someone is as dumb as i am and this will help them one day.. lol don't force yourself to code for a deadline.. it just makes you sloppy! **

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.