Go Back  HTML Forums - Free Webmaster Forums and Help Forums > WEBSITE DEVELOPMENT > Databasing
User Name:
Password:
 

Reply
Thread Tools   Display Modes
  View First Unread
 
Old 09-13-2009, 06:17 PM
  #1
BrandonDiaz
Novice (Level 1)
 
Join Date: Sep 2009
Posts: 1
iTrader: (0)
BrandonDiaz is an unknown quantity at this point
File that Saves Info

Hi, atm, i have a Php file that saves whatever they type in the text boxes.

looks like this
PHP Code:
<?php
header
("Location: contact2.html");
$handle =

fopen("Contact.txt""a");
foreach(
$_GET as

$variable => $value) {
fwrite($handle,

$variable);
fwrite($handle"=");

fwrite($handle$value);
fwrite($handle,

"\r\n");
}
fwrite($handle"\r\n");
fclose($handle);
exit;
?>
How can i make something similiar to that, but instead of saving what all the people type in the same file, i wanted to make seperate files for each person, and the name of the file would be thier name or w.e.


Heres the example of what im talking about.
www.brandondiaz.blackapplehost.com/contact.html
BrandonDiaz is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 09-14-2009, 09:15 PM
  #2
Rubbish_Man
Fighter (Level 4)
 
Join Date: Feb 2008
Location: Kelowna B.C. Canada
Posts: 32
iTrader: (0)
Rubbish_Man is an unknown quantity at this point
store your info in a database

Maybe it would be better to store your info in a database.
__________________
Don't be a pig!
http://okRubbish.com
Rubbish_Man is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 09-18-2009, 03:59 AM
  #3
cmetz1977
Champion (Level 13)
 
cmetz1977's Avatar
 
Join Date: May 2008
Location: Lakeland, FL
Posts: 217
iTrader: (0)
cmetz1977 will become famous soon enough
How is the user identified? Do they log in to your site? Do they simply enter their name/identifier in the form they are filling?

Once you identify the user with, say $user, just insert that variable into the filename.
PHP Code:
fopen"Contact.{$user}.txt""a" );
or 
fopen"Contact_{$user}.txt""a" );
or 
fopen"Contact" .$user .".txt""a" );
or 
fopen"Contact_" .$user .".txt""a" );
... 
There's quite a few ways to phrase that. If you are going to place the variable within the same quoted string as, and abutted to symbols, be sure to wrap your variable reference in "{" and "}" or PHP will try to look for a variable called $user_ or whatnot.

Consider the database as well, it offers several advantages to sort your data, including timestamping for ordering...
__________________
Never accept Kool-aid from someone who won't drink from the same punch bowl.
cmetz1977 is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote

Reply
KEEP TABS
SPONSORS
 
Boxedart



 
 


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



 
  POSTING RULES
 
 
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Thread Tools
Display Modes

Forum Jump

 

All times are GMT -5. The time now is 09:25 AM.

   

Mascot team created by Drawshop.com

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.

Server Monitoring by ENIACmonitor 0.01
HTMLforums.com © Big Resources, Inc. Web Design by BoxedArt.com
vRewrite 1.5 beta SEOed URLs completed by Tech Help Forum and Chalo Na.