Previous Thread
Next Thread
Print Thread
Rate Thread
#262079 11/04/2003 3:18 PM
Joined: Nov 2001
Posts: 745
Admin Emeritus
Admin Emeritus
Offline
Joined: Nov 2001
Posts: 745
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.

Sponsored Links
Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
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.

Joined: Nov 2001
Posts: 745
Admin Emeritus
Admin Emeritus
Offline
Joined: Nov 2001
Posts: 745
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.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
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.

Joined: Nov 2001
Posts: 745
Admin Emeritus
Admin Emeritus
Offline
Joined: Nov 2001
Posts: 745
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.

Sponsored Links

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,157
Joined: July 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)