?
Solved

a lil help

Posted on 2003-03-03
9
Medium Priority
?
244 Views
Last Modified: 2012-05-04
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
Comment
Question by:loonysalmon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 15

Expert Comment

by:VGR
ID: 8059942
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
 

Author Comment

by:loonysalmon
ID: 8060149
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
 
LVL 15

Expert Comment

by:VGR
ID: 8060198
???

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
Independent Software Vendors: 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!

 

Author Comment

by:loonysalmon
ID: 8062417
0
 
LVL 15

Expert Comment

by:VGR
ID: 8062812
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
 

Author Comment

by:loonysalmon
ID: 8066843
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
 

Accepted Solution

by:
roberlamerma earned 80 total points
ID: 8067012
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
 
LVL 33

Expert Comment

by:snoyes_jw
ID: 11934029
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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question