Results 1 to 6 of 6

Thread: [RESOLVED] Textarea

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2005
    Posts
    16

    Resolved [RESOLVED] Textarea

    What is wrong with this!
    PHP Code:
    <?php
    echo "<pre>";
    echo 
    "<textarea name=\"codeview\" cols=\"80\" rows=\"15\" id=\"codeview\">";
    if (!(
    $f=fopen("test.txt","r"))) 
    exit(
    "Unable to open file.");
    while (!
    feof($f)) 

    $x=fgetc($f); 
    echo 
    $x;
    }
    echo 
    "</textarea>";
    echo 
    "</pre>";
    fclose($f);

    if(
    $_POST['save']){
    $code $_REQUEST['codeview'];
    echo 
    "$code";
    }

    ?>
    <html>
    <form name="save" method="post" action="test.php">
    Save.<br>
    <input type="submit" name="save" value="Save.">
    </form></html>

  2. #2
    Addicted Member BIOSTALL's Avatar
    Join Date
    Apr 2005
    Location
    Northampton, UK
    Posts
    180

    Re: Textarea

    Whats happening?? Are you getting an error message of any kind??

    BIOSTALL

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jul 2005
    Posts
    16

    Re: Textarea

    No, it isnt echoing what is in the text area. No errors.

  4. #4
    Fanatic Member ALL's Avatar
    Join Date
    Jul 2004
    Location
    192.168.1.1
    Posts
    711

    Re: Textarea

    works perfectly fine for me:

    http://www.tkforums.com/test.php
    Attached Files Attached Files
    Please support one of my projects?
    TKForums.com

    Web Forum
    JavaScript Wiki
    ________________________
    If somone helps you, please rate their post, by clicking the to rate their post

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jul 2005
    Posts
    16

    Re: Textarea

    The code is supposed to read what is in the text file, then display it on the text area...once I edit the text area and hit save, its supposed to echo w/e is on the text area onto the webpage. The link you sent me doesnt do that.

  6. #6
    Fanatic Member ALL's Avatar
    Join Date
    Jul 2004
    Location
    192.168.1.1
    Posts
    711

    Re: Textarea

    try this then:
    PHP Code:
    <html> 
    <form name="save" method="post" action="test.php">
    <?php
    echo "<pre>"
    echo 
    "<textarea name=\"codeview\" cols=\"80\" rows=\"15\" id=\"codeview\">"
    if (!(
    $f=fopen("test.txt","r"))) 
    exit(
    "Unable to open file."); 
    while (!
    feof($f)) 

    $x=fgetc($f); 
    echo 
    $x

    echo 
    "</textarea>"
    echo 
    "</pre>"
    fclose($f); 
    if(
    $_POST['save']){ 
    echo 
    str_replace("\n""<br>"htmlspecialchars($_POST['codeview'])); 
    }
    ?><p>
    Save.<br> 
    <input type="submit" name="save" value="Save."> 
    </form></html>
    check link again: http://www.tkforums.com/test.php
    Last edited by ALL; Jul 9th, 2005 at 06:40 PM.
    Please support one of my projects?
    TKForums.com

    Web Forum
    JavaScript Wiki
    ________________________
    If somone helps you, please rate their post, by clicking the to rate their post

Posting Permissions

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



Click Here to Expand Forum to Full Width