Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 21st, 2006, 11:22 AM   #1
Oddball
Newbie
 
Join Date: Jan 2006
Location: UK
Posts: 18
Rep Power: 0 Oddball is on a distinguished road
Storing variables to a file?

Hi all, just a query for a friend of mine.

I know there is a way that you can pass user defined variables into PHP, and then store them as a file? For example, if you had a form like this:

<form action="foo.php" method="POST">
Please Enter Your Name: <input type="text" name="name">
<input type="submit" value="Submit">
</form>

Or whatever. And then you can have something like this (foo.php):

<html>
<body>

<?php echo $_POST["name"]; ?>!!! What kind of a name is that?

</body>
</html>

So, is there a way you can get that $_POST["name"]; to write to a file?

Thanks for you help guys! :banana:
__________________
There are 10 types of people in this world:
Those that understand binary
And those who don't
Oddball is offline   Reply With Quote
Old Mar 21st, 2006, 1:02 PM   #2
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,467
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
look into file, fopen, fputs and fclose... as soon as you obtain the var from $_POST[] you can open a file and write the var to it.
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Mar 21st, 2006, 2:09 PM   #3
Oddball
Newbie
 
Join Date: Jan 2006
Location: UK
Posts: 18
Rep Power: 0 Oddball is on a distinguished road
Oooooh, thank you very much monsieur.
__________________
There are 10 types of people in this world:
Those that understand binary
And those who don't
Oddball is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

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 On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:52 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC