...

View Full Version : Text Area Field



user55
07-23-2007, 11:12 PM
Hi,

I can't get the form value of this textarea field below to display when updating a form.



$cellvalue = "";
if ((!isset($_GET["cf2"])) && (!isset($_POST["cf2"]))) {
$itemvalue = $row[2];
} else {
$itemvalue = qsrequest("cf2");
}
$cellvalue = "<textarea class=\"ta\" name=\"cf2\" value=\"" . qsreplace_html_quote(stripslashes($itemvalue)) . "\" ></textarea>";
if ($cellvalue == "") {
$cellvalue = "&nbsp;";
}
echo "<td>" . $cellvalue . "</td>";


Does anybody see anything wrong with it? Any help is appreciated! Thanks!

_____________________________
Sara

_Aerospace_Eng_
07-23-2007, 11:14 PM
Echo $itemvalue after the if statement. I'm guessing $itemvalue is only local to the if else statement. You need to make it global.

$cellvalue = "";
$itemvalue = "";
if ((!isset($_GET["cf2"])) && (!isset($_POST["cf2"]))) {
$itemvalue = $row[2];
} else {
$itemvalue = qsrequest("cf2");
}
$cellvalue = "<textarea class=\"ta\" name=\"cf2\" value=\"" . qsreplace_html_quote(stripslashes($itemvalue)) . "\" ></textarea>";
if ($cellvalue == "") {
$cellvalue = "&nbsp;";
}
echo "<td>" . $cellvalue . "</td>";

user55
07-23-2007, 11:32 PM
Hi,

Thanks for the reply. I still couldn't get it to work. Below is the original code. Its originally a text box and not a text area. I just wanted to convert it to a text area. It works just fine when its like this. How would I convert this into a text area field?



$cellvalue = "";
if ((!isset($_GET["cf2"])) && (!isset($_POST["cf2"]))) {
$itemvalue = $row[2];
} else {
$itemvalue = qsrequest("cf2");
}
$cellvalue = "<input type=\"text\" name=\"cf2\" value=\"" . qsreplace_html_quote(stripslashes($itemvalue)) . "\" size=\"30\" maxlength=\"24\" >";
if ($cellvalue == "") {
$cellvalue = "&nbsp;";
}
echo "<td>" . $cellvalue . "</td>";


_________

Sara

_Aerospace_Eng_
07-23-2007, 11:39 PM
Oh sorry wasn't reading properly. Thats not how you set the value of a textarea. This is the proper way

$cellvalue = "<textarea class=\"ta\" name=\"cf2\">".qsreplace_html_quote(stripslashes($itemvalue))."</textarea>";

CFMaBiSmAd
07-24-2007, 12:02 AM
wasn't reading properly.I have determine from my own experience that after you read a few thousand posts of someone else's code, that you go blind. :cool:

user55
07-24-2007, 02:02 AM
Thanks a lot for your help! It works great now!

Sara



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum