UBB.Dev
Posted By: Ron M HTML inside an HTML form - 11/04/2003 10:18 PM
I'm trying to have a tidbit of data with HTML code in a mySQL table. Then I would like to edit it via a webform, however, the form is complaining about the HTML in the value clause.

Any ideas how to get it to behave?

Code
<textarea rows="8" cols="60" name="ftext" value="<? echo($stext) ?>"></textarea>


I am running the string thru addslashes before it is written to the db.
Posted By: omegatron Re: HTML inside an HTML form - 11/04/2003 10:34 PM
What are you storing? If you are adding slashes then would not

<textarea rows="8" cols="60" name="ftext" value="$stext"></textarea>

work

If you look in editbasic.php and changebasic.php in threads You will get a better ideal on how fields store and pull info.
Posted By: Ron M Re: HTML inside an HTML form - 11/04/2003 11:09 PM
I'm not a Threads user. I'm a classic user who writes PHP (and has done some PHP + Classic integration).

What I'm trying to write is a news function. Where I go in to the admin tools, I can post an announcement with HTML in it. I have gotten that part done. The part that is giving me trouble is the edit part. Fetching the article from the database, and displaying in a form allowing an edit by a user. And I'm not allowing the users to have access to phpMyAdmin.
Posted By: JoshPet Re: HTML inside an HTML form - 11/04/2003 11:20 PM
OK - I *think* this will help you.

To display HTML in a form for editing - you might want to convert the <br /> back into line breaks withing the text area.

$stext = str_replace("<br />","\n",$stext);


Then convert the " marks to "

$stext = str_replace(""",""",$stext);


Then I also believe you'll have to convert < and > so that they don't bust the form.

$stext = str_replace("<"","<",$stext);
$stext = str_replace(">"","&qt;",$stext);

I think that should do it.
Posted By: Ron M Re: HTML inside an HTML form - 11/04/2003 11:50 PM
Yeah that sent me down the right path after a couple tweaks to the code.

Then I was panicking because it wasn't showing in the box. Stupid me forgot the syntax of textarea after that.
© UBB.Developers