PDA

View Full Version : Variable into textfield



bodyvisual
July 29th, 2004, 10:32 AM
How do i pass a variable (like from a txt file) into a textarea in PHP? I'm a bit confused on how to do it..

thx in advance :D

mdipi
July 29th, 2004, 01:06 PM
I think you might need some JavaScript to acheive this. Im not 100% though.

bodyvisual
July 29th, 2004, 01:09 PM
i think you have to open the file first... :P

ol4pr0
July 29th, 2004, 01:31 PM
ie:


#read from file
<?
$file = '???.txt' ;
$fh = fopen($file,'r') or die ("couldnt open file to read");
$file_size =filesize($file);
$file_content = fread($fh,$file_size);
fclose ($fh);
echo '<TEXTAREA NAME="" ROWS="" COLS="">'.$file_content.'</TEXTAREA>';
?>


No need for java @ all.

bodyvisual
July 29th, 2004, 01:34 PM
woot woot thanks a lot man!

:D