| ★ wanayoo — archive 1999 http://www.devshed.com/Talk/Forums/Forum5/HTML/001727.html | Nouvelle recherche | Portail wanayoo |
|
|
DevShed Discussion Forums
![]() PHP
![]() Editing files in a <textarea>
|
| next newest topic | next oldest topic |
| Author | Topic: Editing files in a <textarea> |
|
alexgreg Member |
OK, I've written this program to let me edit ASCII files on my server in a <textarea>. However, if the file that is being edited contains a textarea within it, then I get problems... To cut a long story short, what I want to do is read this file into the textarea but I want to convert all of the < and > characters to < and > 's. I figgered you'd do this through Regular Expressions: however these are poorly documented in the PHP book I have, though the Perl book I have tells me how to do this. Could someone tell me how to do this, IN PHP! Thanks very much. -------------------------- oh yeah, here's the code: code: The program gets send a variable by the calling form called "file". |
|
polman Member |
$file = eregi("<","<",$file); $file = eregi(">",">",$file); If you want a good place to look for info, www.php.net has a searchable list of all the functions and explains them fairly well. |
|
alexgreg Member |
Thanks, but whereabouts does the code go? |
|
polman Member |
Man, the 2nd "<" and the 2nd ">" should be the & lt; and the & gt; ... it just displayed it wrong. Anyway that should go after the readfile. |
|
terium Member |
Actually, what you want is htmlspecialchars(). This will change &, ", <, and > to HTML entities. So, if you have: and do this: you'll get this: HTH |
|
terium Member |
Actually, what you want is htmlspecialchars(). This will change &, ", <, and > to HTML entities. So for every print() statement that you have with < or >, do this (not tested): HTH |
All times are MST (US) | next newest topic | next oldest topic |
![]() |
|
Copyright © 1997-2000 ngenuity. All rights reserved.
Powered by: Ultimate Bulletin Board, Version 5.41a
© Infopop Corporation (formerly Madrona Park, Inc.), 1998 - 1999.