Go Back   CodingForums.com > :: Server side development > Perl/ CGI

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-01-2002, 06:40 AM   PM User | #1
artur
New to the CF scene

 
Join Date: Oct 2002
Location: Finland
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
artur is an unknown quantity at this point
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?
artur is offline   Reply With Quote
Old 10-02-2002, 11:19 PM   PM User | #2
Ahmed
New to the CF scene

 
Join Date: Oct 2002
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Ahmed is an unknown quantity at this point
try

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

this will skip empty lines.
Ahmed is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:04 PM.


Advertisement
Log in to turn off these ads.