Forum Moderators: coopster

Message Too Old, No Replies

fopen and fwrite to file.php through form.

         

ShoT

6:46 am on Mar 15, 2006 (gmt 0)

10+ Year Member



I have a form, it saves people information, for example, you input it through a form with the fields of name, shortname (the filename of the php file) and a description. Right now, I want to be able to copy something from word (with HTML tables) into the form and so it would display the tables copied properly, but when I do copy it, and submit the form, theres no HTML. I know this can be achieved if I set up a WISWYG or whatever editor on the form. Does anyone know of any simple one or a better way? I really don't care about anything else as long as I can copy and paste from word and it includes the HTML tags.

Thanks

dreamcatcher

8:15 am on Mar 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You could try a rich text editor.

Try FCK Editor:
[fckeditor.net...]

dc

ShoT

3:29 pm on Mar 15, 2006 (gmt 0)

10+ Year Member



Right, allthough that is good, I don't really want the whole interface on top, just so that when I copy from word it copies the HTML code also.

dreamcatcher

8:58 am on Mar 16, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Looks like a simple WYSIWYG editor might be best. Maybe Frontpage Express?

dc

ShoT

3:15 am on Mar 17, 2006 (gmt 0)

10+ Year Member



Ok I have tried FCKeditor and HTMLArea, with unpredictable results.

What I am doing.

I have a form, with these fields:
Name //The name, appear as link
Short Name // the filename, where the link leads
ID // so it displays with a certain event only
Description // copied from MS Word, with tables, thats the most important thing. Saves this to a file called for example mydad.html

The form saves Name, short name, and ID to MySQL DB, so I can pull out the info with a query and assign the variables to a link, so it lists for example:
Me Myself My Dad My Mom

... as links, when clicked on, a JS Popup opens with the saved file from shortname. I hope you get the idea.

In any case, in both FCKeditor and HTMLArea, when I wrote a text in my description, for example the text was "Testing 1,2,3" and assigned it a red color, size of Large, and centered it, it appeared in Green, Medium sized letters, and aligned to the left.

I have no clue what to do, on top of that, the tables came out all screwed up pasted in from Word.

Someone please help, I honestly dont know what to do and why is that problem appearing. THanks.

PS - I just looked up FrontPage Express, its a desktop based editor, I do not want that, I want it in the form.

ShoT

4:17 am on Mar 17, 2006 (gmt 0)

10+ Year Member



Okay, I just modified the script for testing:

If I insert the "description" field into MySQL DB, here's the information that gets inputted:


<p align="center"><font color="#993300" size="6"><strong>ALEXI KASATANOV</strong></font></p>

While, this is the code that gets written to the file:


<p align=\"center\"><font color=\"#993300\" size=\"6\"><strong>ALEXI KASATANOV</strong></font></p>

The DB code looks 100% what it was in the WYSIWYG Editor, while the fwrite one looks completely screwed up because of the "\", can anyone tell me why are they written?

ShoT

4:50 am on Mar 17, 2006 (gmt 0)

10+ Year Member



I just answered my own question.

The reason:

magic_quotes_gpc
//Adds the damn slashes

The solution:
$description = stripslashes($description);
// Before fwrite.