Hi all,
New to the board, and to fckeditor in general, so please go easy on me here!
I am having an issue and I've checked the docs. I am unable to find out what I am doing wrong
I have a form that users fill out and for the text portion, I decided to use fckEditor. My code for the form is as follows:
<form method="post" action="create2.php"> <input type="hidden" name="author" value="<?php echo $_SESSION['username'];?>"> <input type="hidden" name="isbeginning" value="1"> <input type="hidden" name="page" value="<?php echo RAND(1,10000000);?>"> <input type="hidden" name="end" value="0"> Title: <input type="text" size="20" name="title"><br><br> Rating: <select name="rating"> <option value="G">G - Everyone</option> <option value="PG">PG</option> <option value="R">R - Adults only</option> </select><br><br> Start Typing! :<br> <?php $oFCKeditor = new FCKeditor('body') ; $oFCKeditor->BasePath = '/fckedit/' ; $oFCKeditor->Value = '' ; $oFCKeditor->Create() ; ?> <input type="submit" value="Submit your story!"> </form>
Now, everything is passed on to create2.php and that looks kind of like this: (Removed unneeded sections of code)
$title=mysql_real_escape_string( $_POST['title'] ) ; $isbeginning=$_POST['isbeginning']; $page=$_POST['page']; $author=$_POST['author']; $body== stripslashes( $_POST['body'] ) ; // BODY VARIABLE FROM FCKEDITOR $rating=$_POST['rating']; $end=$_POST['end']; $sql = "select * from stories"; $query = mysql_query($sql); while ($row = mysql_fetch_array($query)) { if ($page==$row['page']) { $page=RAND(1,10000000); }; }; ?> You have added the following: <br> Title: <?php echo $title;?><br> Author: <?php echo $author;?><br> Random Page #: <?php echo $page;?><br> Your story:<br> <?php echo $body;?><br>
Everything shows up fine, except for what was typed in the FckEditor, that is returned blank.
I looked at the samples, and they seem to say that this line:
$oFCKeditor = new FCKeditor('body') ;
is storing everything I type in the editor as $body variable and SHOULD be passing this along with the rest of the data in the form, but it's not working.
Please tell me what I am doing wrong here I really would prefer to use this instead of an ugly old text box.
Re: noob help needed, passing variable in form ...
Re: noob help needed, passing variable in form ...
In my code, you'll notice that I used body as the variable in which the body of text entered into the editor was stored as.
I called body in the $_POST and it would not work.
I changed the variable name to test and called test, and now it works fine.
Perhaps body is disallowed?
Well, it works anyhow, so that's a big issue I don't have to worry about now. Hope if anyone else is running into this kind of problem that this solves it.