Forum Moderators: coopster

Message Too Old, No Replies

Textareas in html/PHP

Retain text in textarea

         

mag1

11:03 am on Dec 3, 2004 (gmt 0)

10+ Year Member



Hi

I've got a form in html/php and I've got checks in place to see if fields are empty. If a field is empty the form seems to refresh. I've managed to retain the text in the input fields by using the following:
<input type ="text" name ="CustName" value="<?php echo $CustName?>">

However I haven't been able to find anyway of doing this for a textarea. Is there anyway of doing this?

Thanks,
mag1

taps

11:07 am on Dec 3, 2004 (gmt 0)

10+ Year Member



I think it is <textarea><?=$strTextareaContent?></textarea> (no guarantee).

But this might be the wrong forum for your question.

mag1

11:26 am on Dec 3, 2004 (gmt 0)

10+ Year Member



Thanks for that, it wasn't quite right but I just added echo and it seems to have done the trick.

<textArea name ="txtName"><?php echo $txtName?></textArea>

Thanks again.

taps

11:36 am on Dec 3, 2004 (gmt 0)

10+ Year Member



welcome :-)

<?=$anyVariable?> works on most PHP-Servers too - but you can disable it in php.ini. So your version is more correct.

coopster

3:14 pm on Dec 3, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, mag1.

PHP calls that the short_open_tag [php.net]. Other options for invoking PHP and more reading is available in the PHP manual under Escaping from HTML [php.net].