NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Form Content PHP Help

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 03-25-2006, 05:30 PM THREAD STARTER               #1 (permalink)
NamePros Regular
 
snike's Avatar
Join Date: Mar 2006
Location: USA
Posts: 497
snike has a spectacular aura aboutsnike has a spectacular aura about
 


Save a Life

Form Content PHP Help


I need a script that has a form and when i submit it everything gets saved in a file
snike is offline  
Old 03-25-2006, 06:03 PM   #2 (permalink)
NamePros Regular
 
Tree's Avatar
Join Date: Feb 2006
Location: Atlanta, GA, USA
Posts: 335
Tree will become famous soon enoughTree will become famous soon enough
 



Working on it now. I'll post it up soon.

Here's a really basic example.

PHP Code:
if(empty($_POST['step']))
{
?><form action="?" method="POST">
<input type="text" name="a_field">
<input type="hidden" name="step" value="2">
<input type="submit"></form><?
}
if(
$_POST['step'] == "2")
{
    
$filename 'data.txt';
    
$somecontent $_POST['a_field']."\n";
    
$handle fopen($filename'a+');
    if (
fwrite($handle$somecontent) === FALSE
    {
       echo 
"Cannot write to file ($filename)";
       exit;
       }
????: NamePros.com http://www.namepros.com/programming/180540-form-content-php-help.html
  
   echo 
"Success, wrote $somecontent to file $filename";
  
   
fclose($handle);
}
You can see it in action here:

http://www.ncisolutions.com/projects...rm-to-file.php

It works now.
Last edited by Tree; 03-25-2006 at 06:23 PM.
Tree is offline  
Old 03-26-2006, 12:13 PM THREAD STARTER               #3 (permalink)
NamePros Regular
 
snike's Avatar
Join Date: Mar 2006
Location: USA
Posts: 497
snike has a spectacular aura aboutsnike has a spectacular aura about
 


Save a Life
is it possible to make it write to another file. like

form.php
and
text.php
snike is offline  
Old 03-26-2006, 06:45 PM   #4 (permalink)
NamePros Regular
 
Tree's Avatar
Join Date: Feb 2006
Location: Atlanta, GA, USA
Posts: 335
Tree will become famous soon enoughTree will become famous soon enough
 



Just change this value: $filename = 'data.txt';
Tree is offline  
Old 03-31-2006, 08:32 PM THREAD STARTER               #5 (permalink)
NamePros Regular
 
snike's Avatar
Join Date: Mar 2006
Location: USA
Posts: 497
snike has a spectacular aura aboutsnike has a spectacular aura about
 


Save a Life
thank you
snike is offline  
Old 04-01-2006, 06:44 AM   #6 (permalink)
NamePros Regular
 
Tree's Avatar
Join Date: Feb 2006
Location: Atlanta, GA, USA
Posts: 335
Tree will become famous soon enoughTree will become famous soon enough
 



You're welcome
Tree is offline  
Old 04-04-2006, 01:46 PM   #7 (permalink)
DomainSeeking.com
 
MCDomains's Avatar
Join Date: Sep 2005
Location: Boston
Posts: 2,446
MCDomains has much to be proud ofMCDomains has much to be proud ofMCDomains has much to be proud ofMCDomains has much to be proud ofMCDomains has much to be proud ofMCDomains has much to be proud ofMCDomains has much to be proud ofMCDomains has much to be proud ofMCDomains has much to be proud ofMCDomains has much to be proud of
 



Third World Education
Excellent, thanks for the info. I'm slowly learnin' PHP
__________________
MCDomains is offline  
Closed Thread


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


Liquid Web Smart Servers  
All times are GMT -7. The time now is 10:51 PM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger