Shoutbox

Printing to a webpage from a .txt file via php - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: Printing to a webpage from a .txt file via php (/showthread.php?tid=77375)

Printing to a webpage from a .txt file via php by banky on 09-11-2007 at 02:20 AM

What I want to do is basically have a page that has fields that say like

[ ] Option 1
[ ] Option 2
[ ] Option 3
Etc...

And when the person select's the option(s) then hits the submit button it'll run the php script and on the next page it would print the option's they picked from the uploaded txt files... So say they picked

Options 1 and clicked submit... Assuming Option 1 is associated with option1.txt it would then print what ever text is in option1.txt into the next page...

So far I have this

code:
<?php

DEFINE('SCRIPT_DIR', $_SERVER['DOCUMENT_ROOT'].'/cscripts/');

$option1 = file(SCRIPT_DIR.'option1.txt');
$option2   = file(SCRIPT_DIR.'option2.txt');
$option3   = file(SCRIPT_DIR.'option3.txt');

?>


This only defines variables to use when printing such as

code:
<?php
print "$option1";
?>



Which should print out what's in option1.txt but on a page i have using

code:
<?php

DEFINE('SCRIPT_DIR', $_SERVER['DOCUMENT_ROOT'].'/cscripts/');

$option1 = file(SCRIPT_DIR.'option1.txt');
$option2   = file(SCRIPT_DIR.'option2.txt');
$option3   = file(SCRIPT_DIR.'option3.txt');

?>
<?php
print "$option1";
?>


Prints out array instead of what's in the txt file.; \

RE: Printing to a webpage from a .txt file via php by ShawnZ on 09-11-2007 at 02:24 AM

http://php.net/file_get_contents


RE: Printing to a webpage from a .txt file via php by banky on 09-11-2007 at 02:27 AM

Thank's i'll take a look at that.