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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    TEXTAREA from html and saving it intoa file!

    Hello!

    I have made an editor that allows to edit userlist. You can edit the userlist by the following TEXTAREA tag on the HTML code:

    print <<End_of_line;
    <form method="POST" action="save_userlist.pl">
    <table width="690">
    <tr>
    <td>
    End_of_line

    foreach $line (@array){
    ($id,$name)=split(/\|/,$line);
    $readout .= "$line";
    }

    print <<End_of_Doc;
    <textarea name="filetext" wrap="off" rows="30" cols="110">$readout</textarea>
    </td>
    </tr>
    </table>
    </form>
    End_of_Doc;

    When I edit this and save it, there might be blank lines left after the last entry, which the shows up on a script that loads the content of the file and prints it out.

    How can I save the file without the blank lines after the last entry?

  • #2
    New to the CF scene
    Join Date
    Oct 2002
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    try

    foreach $line (@array){
    $readout .= $line if ( $line !~ /^$/);
    }

    this will skip empty lines.


  •  

    Posting Permissions

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