PHP Echo Info Textarea

Hi all, seem to be having a problem echoing into a textarea. My code is below. I’m basically validating my form. But nothing is echoing into the textarea. I’m using XHTML if that makes any difference?

<textarea name="caddress" rows="6" cols="0" class="<?php if(isset($alert[3])){echo $alert[3];} else {echo "textField";} ?>"><?php echo $_POST['caddress'] ?></textarea>

Appreciate any help or advice :smiley:

The value attribute of the textarea is equivalent to what goes inside the actual textarea. Is that what you were referring to?

Hi, thanks for your reply. No, I have tried echoing into the textarea value attribute but still not producing any echo. So not sure where I’m going wrong?

I don’t think textarea has a value attribute .

This works fine in my IE8

<?php

$str = 'Enter some text';

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>

    <form action="#" method="post">
        <textarea name="txtArea1" cols="20" rows="5" ><?php echo $str; ?></textarea>
    </form>

</body>
</html>

Maybe your $_POST[‘caddress’] doesn’t have a value assigned to it???

Hey dude, yeah it was me, I had two textarea’s both with the same names from where I had copied and pasted earlier. Guessing it was sending things into a bit of a hissyfit! Cheers for your help, appreciated :smiley: