Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6

Thread: Text Area Field

  1. #1
    New Coder
    Join Date
    Jul 2007
    Posts
    62
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question Text Area Field

    Hi,

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

    PHP Code:
    $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

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Echo $itemvalue after the if statement. I'm guessing $itemvalue is only local to the if else statement. You need to make it global.
    PHP Code:
    $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>"
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    New Coder
    Join Date
    Jul 2007
    Posts
    62
    Thanks
    2
    Thanked 0 Times in 0 Posts
    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?

    PHP Code:
    $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

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Oh sorry wasn't reading properly. Thats not how you set the value of a textarea. This is the proper way
    PHP Code:
    $cellvalue "<textarea class=\"ta\" name=\"cf2\">".qsreplace_html_quote(stripslashes($itemvalue))."</textarea>"
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #5
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,130
    Thanks
    2
    Thanked 328 Times in 320 Posts
    Quote Originally Posted by _Aerospace_Eng_ View Post
    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.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #6
    New Coder
    Join Date
    Jul 2007
    Posts
    62
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Thanks a lot for your help! It works great now!

    Sara


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •