...

View Full Version : TEXTAREA from html and saving it intoa file!



artur
10-01-2002, 07:40 AM
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?

Ahmed
10-03-2002, 12:19 AM
try

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

this will skip empty lines.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum