From: "Paul Warner" <[EMAIL PROTECTED]>
> Simon-
>
> Thanks for the tip...I trued using the htmlspecialchars() which allowed
the
> remainder of the form to display properly, but left no value in the
> textarea. Then I noticed a difference in the method I was using compared
to
> yours - I'm still learning the ways of PHP so it will take me a while to
> determine the significance of the syntax differences:
>
> Mine: <td width = "60%"><?php echo $linkurl . '<br><textarea
> value="htmlspecialchars($linkurl)"></textarea></td>\n' ?>
>
> Yours: <?php echo "<textarea>" . htmlspecialchars($link) . "</textarea>"
?>
>
> I wanted a graphical representation of the present link displayed above
the
> textarea and then attempted to use php's substitution to build the text
area
> within the same string. I updated my code to be more like yours and
arrived
> at:
>
> <?php echo $linkurl . '<br><form>'?><?php echo "<textarea>" .
> htmlspecialchars($linkurl) . "</textarea>\n"?>
>
> which seems to make the parser behave as I intended.
>
> Anyway...thanks!
>
> -- Paul
>
Ah, the HTML <TEXTAREA> element does not support a VALUE attribute so your
way will not work. :)
Unlike <INPUT> tags, the contents (value) of a textarea should be inserted
between the <textarea>...</textarea> tags, rather than as an attribute.
Hence what you need is:
<td width="60%"><?php echo $linkurl . "<br><textarea>" .
htmlspecialchars($linkurl) . "</textarea></td>\n"; ?>
In the outputted HTML this will give you:
<td width="60%"><a href="http://www.blah.com">Blah</a><br><textarea><a
href="http://www.blah.com">Blah</a></textarea>
Which should render as a link, followed by a textarea with the HTML code for
that link. If you want the first link to render as code as well then you
need to run it through htmlspecialchars() too.
Cheers
> ----- Original Message -----
> From: "Simon Garner" <[EMAIL PROTECTED]>
> To: "Paul Warner" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
> Sent: Wednesday, February 21, 2001 8:19 PM
> Subject: Re: [PHP] pop textarea field w/ text incl. quotes
> >
> > Don't worry about quotes - the problem is that you have HTML markup
inside
> > your <textarea>. You just need to convert < and > to < and >,
> > respectively, in your link text. The functions htmlspecialchars() or
> > strip_tags() can do this for you.
> >
> > i.e.:
> >
> > <? echo "<textarea>" . htmlspecialchars($link) . "</textarea>" ?>
> >
> > When the form is submitted (and when it's viewed), those entities will
be
> > converted back to their real characters automatically by the browser.
> >
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]