Current location: Hot Scripts Forums » General Community » Script Requests » Hello! I'm retarded!


Hello! I'm retarded!

Reply
  #1 (permalink)  
Old 04-13-10, 08:33 AM
azafreak azafreak is offline
New Member
 
Join Date: Apr 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
X_X Hello! I'm retarded!

I signed up to this fabolous site to pose a super simple question/request.

I wish i knew how to make it, but i dont.

A webpage with a text input box, and a submit button.
text is sent to a new line on a serverside .txt file.

kind of like a reverse twitter now i think about it.

props to whoever helps me without over 9000 noob based insults.
Reply With Quote
  #2 (permalink)  
Old 04-13-10, 10:04 PM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 3,454
Thanks: 0
Thanked 140 Times in 137 Posts
Here is a simple script that creates a file called myFile.txt.
Every time you enter some text into the form and submit it, that line of text get added to the file.
Then after the file is created, it displays the contents line by line.

This script requires that you have PHP installed with the server (ie: Your hosting account includes PHP).
PHP Code:

<html>
<head>
<title>Simple file creator.</title>
</head>
<body>
<?php
if(!empty($_POST["submit"]))
{
 
$fh fopen("myFile.txt","a");
 if(!empty(
$_POST["theText"])){fwrite($fh,stripslashes($_POST["theText"])."\r\n");}
 
fclose($fh);
 }
if(
file_exists("myFile.txt"))
{
 echo 
"<span style='color:#00f;font-size:24px;font-weight:bold;'>myFile.txt</span> <span style='font-size:18px;'>contains the following data.</span><p><div style='float:left;padding:10px;padding-bottom:0px;border:1px solid #000;'>";
 
$fh fopen("myFile.txt","r");
 while(!
feof($fh))
 {
  echo 
fgets($fh)."<br />";
  }
 
fclose($fh);
 echo 
"</div><br style='clear:both;' />";
 }
?>
<div style="float:left;margin-top:20px;padding:10px;padding-bottom:0px;border:1px solid #000;">
<form action="#" method="post">
Enter some text: <input type="text" name="theText"><p>
<div style="text-align:center;"><input type="submit" name="submit" value="Submit"></div>
</form>
</div>
</body>
</html>
__________________
Jerry Broughton
Reply With Quote
Reply

Bookmarks

Tags
lol tags?, noob, simple, webpage


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT -5. The time now is 10:01 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.