Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 258
  • Last Modified:

a lil help

ok.
on my webpage, i want to put a link for the people in my classes to see the hw for the current day.

i'm a complete n00b and i wanna know how to do the following:

on my page(where i use the input boxes to enter the hw)
multiple input text boxes-->save to txt files on server (1 txt file per class)


On the html/php page where people will see what the hw is, i want to read the txt file.  
how would i do that?
once again, let me reiterate.  i am a total newbie.

my server doesn't support perl or asp.  so can we try to do this in php or html?

thx a million in advance
0
loonysalmon
Asked:
loonysalmon
1 Solution
 
VGRCommented:
you've a lot of solutions to read a textfile.

To directly output the contents : int readfile (string filename, int [use_include_path])

To read the content in an array : array file (string filename [, int use_include_path])

You can also fopen()/fgets()/fclose()
0
 
loonysalmonAuthor Commented:
once i had the file, i would read it like this:?:?::
<script src="www.server.com/school/classname.txt"></script>

would that work for when i had the file?


what i'm looking for is something that i can fill out anywhere. So I could add the hw during class.  do you catch what i'm saying?

the part that i need help on is writing the file.  i say that we just get one file write script done and i can probably work my way from there.
0
 
VGRCommented:
???

just output the contents in your HTML generated code...
you can do readfile() and the contents will go in the resulting HTML page at the place wher you put the readfile...

or put the contents in a TEXTAREA form field...

or output it line per line until count($arrayread) with <BR> as EoLn

or use nl2br()

I DON'T UNDERSTAND YOUR PROBLEM

WHAT CAN YOU DO/HAVE DONE, AND WHAT CAN YOU NOT DO/HAVEN'T DONE ?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
loonysalmonAuthor Commented:
0
 
VGRCommented:
ah ok, so you want to write the contents of an HTML FORM's field (say , it's a TEXTAREA - 32KB limit) to a text file ?

No problemo, akuna matata :

$fp=fopen('thepath/thename.txt','w');
fputs($fp,$TextAreaVariable);
fclose($fp);

// it's done...
0
 
loonysalmonAuthor Commented:
so...
what type of file will i be using?
html or php?
if so, how do i put it in.  
an example for a multiple line text input box written to a file would be helpful. (the script for the multiple line text input box and the write to file included would be nice.)

thx!
0
 
roberlamermaCommented:
the script for the multiple line text input box...
<html>
<head>
.
.
.
<form action='do.php' method='post'>
<?
$size = count($hws);
for($i=0;$i<$size;$i++) { //I'm supposing you have an array
                          //of hw's
  echo $hws[$i]."<input type='text' name='hw_$i'><br>\n";
}
?>
.
.
</html>

the 'do.php' script...
<?
foreach ($_POST as $hw=>value) {
  $fp=fopen("./$hw.txt","w");
  fputs($fp,$value);
  fclose($fp);
}
?>

Hope this helps!

0
 
snoyes_jwCommented:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I will leave the following recommendation for this question in the Cleanup topic area:
    Accept: roberlamerma {http:#8067012}

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

snoyes_jw
EE Cleanup Volunteer
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now