Forum Moderators: coopster & phranque

Message Too Old, No Replies

reading a file into a text area

         

g00fy

12:51 am on Feb 12, 2003 (gmt 0)

10+ Year Member



hi to all,

i have a subscribe me (perl) script and i am trying to read the contents of my subscribers database file into a textarea that is on my admin console. i.e., i want it all to appear on the one page,

my db file is not url accessable but is already defined as "$memberinfo/address.txt", where it is an absolute path to the file.

this is my code but i get server errors,

i tried having the textarea already on the page and append the contents to it, but i didnt know how to target the textarea

and i dont know how to append a textarea to a page once the page is created.


<form action="&addresses" method="post" name="email_butt" id="email_butt">
<input type="submit" name="Submit" value="Show Subscribers">
</form>


sub addresses{
open (ADDR,"<$memberinfo/address.txt");
@addr = <ADDR>;
close(ADDR);
print <textarea name="address" cols="50" rows="10" wrap="OFF" id="address">
foreach $line (@addr)
{
print "$line";
}
print </textarea>
}

if ths is impossible i am quite happ to have the subscribers appear within a textarea on another page :(

thanx to all

knid regards,

g00fy

andreasfriedrich

1:02 am on Feb 12, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld [webmasterworld.com] g00fy.

Be sure to read Marcia`s WebmasterWorld Welcome and Guide to the Basics [webmasterworld.com] post.

Do it like this:


print [perldoc.com] <<END; # just a nice way of quoting: heredoc style
<html code>
END
#
open [perldoc.com] 'ADDR', "<$memberinfo/address.txt"
or die [perldoc.com] "Can't open file: $!\n";
print [perldoc.com] <ADDR>; # print out the whole file
close [perldoc.com] 'ADDR';
#
print [perldoc.com] <<END; # your html code
</html code>
END

Andreas

g00fy

1:47 am on Feb 12, 2003 (gmt 0)

10+ Year Member



thanx andreas but im still having trouble please see my code below


<form action="&addresses" method="post" name="email_butt" id="email_butt">
<input type="submit" name="Submit" value="Show Subscribers">
</form>
</div></td>
</tr>
</table>
EOF
&footer2;
&footer;
exit;
}

sub addresses{
print <<END
<html>
<head>
<title></title>
</head>
<body>
<CENTER><BR>
<TABLE BORDER="0" WIDTH="400">
<TBODY>
<TR>
<TD>
<textarea name="address" cols="50" rows="10" wrap="OFF" id="address">
END
#
open 'ADDR', "<$memberinfo/address.txt" or die "Can't open file: $!\n";
print <ADDR>;
close 'ADDR';
print <<END;
#
</textarea>
</TD>
<TR>
</TBODY>
</TABLE>
</CENTER>
</body>
</HTML>
END #
}

this returns a 404 error to me but other parts of the form accept this var ($memberinfo/address.txt) without a 404

g00fy

2:38 am on Feb 12, 2003 (gmt 0)

10+ Year Member



hello again,

when i use the absolute path, the browser is redirected back to the original login for the whole console :(

i really dont know what is goin on here.

any help would be gr8

regards

g00fy