Reply LinkBack Thread Tools Search this Thread
Old 11-03-2004, 08:36   #1 (permalink)
weldo
now with added beard
 
weldo's Avatar
 
Join Date: Mar 2004
Location: Liverpool
Posts: 5,432
passing form input to text file via PHP ?

Inspired by a text file question i saw on here today, I wonder if anyone can give me a quick example of passing text area input from a form to fill areas of a text file ??

I'm sure I'll need to go the whole hog and learn PHP and MySql, but in the meantime any help would be trmendously helpful.....

I'll be yer best mate forever.....
  Reply With Quote
Old 26-07-2007, 22:46   #2 (permalink)
imagn
Registered User
 
Join Date: Jul 2007
Posts: 21
Can you not install MySQL? It's easier...
  Reply With Quote
Old 27-07-2007, 04:25   #3 (permalink)
datahound
Spare Parts
 
datahound's Avatar
 
Join Date: Jan 2005
Location: Bracknell Forest
Posts: 4,960
Code:
function getanylinefromfile($int,$file) { $result = ""; $count = "0"; $fp = fopen ($file, "r") or die("Couldn't open $filename"); while (! feof($fp)){ $line = fgets($fp,1024); $count = $count + 1; if ($count == $int){ $result = $line; } } $result = stripslashes("$result"); return $result; } function gethtmlfromfile($file){ $filename = "$file"; $htmlfromfile = ""; $fp = fopen ($filename, "r") or die("Couldn't open $filename"); while (! feof($fp)){ $line = fgets($fp,1024); $htmlfromfile = "$htmlfromfile"."$line"; } $htmlfromfile = stripslashes("$htmlfromfile"); return $htmlfromfile; } function writealltofile($text,$file){ $fp = fopen ($file, "w") or die("Couldn't open $file"); flock ($fp,LOCK_EX); fwrite($fp, "$text"); flock ($fp,LOCK_UN); fclose ($fp); } function writelinetofile($lineint,$linetext,$file){ $fp = fopen ($file, "r") or die("Couldn't open $file"); $writeback = ""; $count = 0; while (! feof($fp)){ $line = fgets($fp,1024); $count = $count + 1; if($count == $lineint){ $writeback = $writeback.$linetext."\n"; } else{ $writeback = $writeback.$line; } } $fp = fopen ($file, "w") or die("Couldn't open $file"); flock ($fp,LOCK_EX); fwrite($fp, "$writeback"); flock ($fp,LOCK_UN); fclose ($fp); }

These are functions I use in many projects.
__________________
  Reply With Quote
Old 27-07-2007, 05:18   #4 (permalink)
weldo
now with added beard
 
weldo's Avatar
 
Join Date: Mar 2004
Location: Liverpool
Posts: 5,432
this thread is THREE AND A HALF YEARS OLD, people !!!!

(but thanks anyway - i never did learn PHP)
__________________
fuck signatures
  Reply With Quote
Old 27-07-2007, 05:29   #5 (permalink)
datahound
Spare Parts
 
datahound's Avatar
 
Join Date: Jan 2005
Location: Bracknell Forest
Posts: 4,960
Ffs! Eee-awwww!
__________________
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8