|  | |  |
04-01-2007, 08:06 PM
|
#16 (permalink)
| | Moderator
Join Date: May 2002 Location: us.ca
Posts: 4,532
| salch.. take some initiative and follow through with what you're doing one topic at a time. when you get a firm handle on it, move on.
i can't help when every follow up question is as general as 'how'
__________________ Mike |
| |
04-02-2007, 12:22 AM
|
#17 (permalink)
| | Salchester
Join Date: Jul 2005 Location: In a house
Posts: 230
| DJMaze,
I'm not to worried about security at this stage, as the server is only being run on a private machine, especially to run the web-page application I'm creating/developing.
I'll probably look more into security as times goes on, when the application will eventually be run on a properly designed, standalone server.
Currently, I just want to see if I can get certain aspects of my application working, before I finally lock it up.
How do I store information from a form on a page into a .txt file?
Many Thanks,
__________________ Many Thanks, in advance! Salchester.
The Future Is Here - Are You Ready? |
| |
04-02-2007, 12:26 AM
|
#18 (permalink)
| | Salchester
Join Date: Jul 2005 Location: In a house
Posts: 230
| SDE,
OK, can you give be a starting point on how to load information from a text file & drop down menu, into a .txt file?
Just to give me a starting point, as I have a basic outline on how to create the file, but not to save information into it from a form.
Many Thanks, much appreciated!!!
__________________ Many Thanks, in advance! Salchester.
The Future Is Here - Are You Ready? |
| |
04-02-2007, 01:29 AM
|
#19 (permalink)
| | Senior Contributor
Join Date: Mar 2005
Posts: 745
| PHP Code: if ($fp = fopen('c:/file.txt', 'w+')) { fwrite($fp, 'some data'); fclose($fp); }
__________________ 
UT: Ultra-kill... God like! |
| |
04-02-2007, 01:36 AM
|
#20 (permalink)
| | Salchester
Join Date: Jul 2005 Location: In a house
Posts: 230
| PHP:Save MySQL Database DJMaze,
How do I store the information entered in the following form to a .txt file, then on a separate page, load the information back from the .txt file into the form elements (Text Box & Drop Menu) Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
</head>
<body>
<form action="" method="post" name="New" id="New">
<input name="Name" type="text" id="Name">
<select name="Sex" id="Sex">
<option>Male</option>
<option>Female</option>
</select>
<input type="submit" name="Submit" value="Submit">
</form>
</body>
</html> Many Thanks,
__________________ Many Thanks, in advance! Salchester.
The Future Is Here - Are You Ready? |
| |
04-02-2007, 08:56 AM
|
#21 (permalink)
| | Moderator
Join Date: May 2002 Location: us.ca
Posts: 4,532
| how to use post data PHP Forms
__________________ Mike |
| |
04-02-2007, 11:03 AM
|
#22 (permalink)
| | Salchester
Join Date: Jul 2005 Location: In a house
Posts: 230
| PHP:Save MySQL Database SDE,
Yes, but how do you store the information from the form into a .txt file upon the submit button being clicked?
Many Thanks,
__________________ Many Thanks, in advance! Salchester.
The Future Is Here - Are You Ready? |
| |
04-02-2007, 01:50 PM
|
#23 (permalink)
| | Newbie
Join Date: Jun 2002 Location: Denmark
Posts: 1,726
| By combining what you've been giving thus far. PHP Code: if(isset($_POST['Name'])||isset($_POST['Sex'])) { if ($fp = fopen('c:/file.txt', 'w+')) { fwrite($fp, $_POST['Name'].'\n'); fwrite($fp, $_POST['Sex'].'\n'); fclose($fp); } }
|
| |
04-02-2007, 01:50 PM
|
#24 (permalink)
| | Senior Contributor
Join Date: Mar 2005
Posts: 745
| fwrite($fp, $_POST['formfield']);
You beat me redhead 
__________________ 
UT: Ultra-kill... God like! |
| |
04-02-2007, 11:02 PM
|
#25 (permalink)
| | Salchester
Join Date: Jul 2005 Location: In a house
Posts: 230
| PHP:Save MySQL Database Redhead,
Can the name and sex be stores on one line, but separated with a ; character or something. Then when another record is enter the name and sex for that record will be saved on the next line of the file, and so on....
Many Thanks,
__________________ Many Thanks, in advance! Salchester.
The Future Is Here - Are You Ready? |
| |
04-03-2007, 12:21 AM
|
#26 (permalink)
| | Moderator
Join Date: May 2002 Location: us.ca
Posts: 4,532
| do you understand what that script is doing salch? \n is a new line. use what you now know and make it a colon instead of a new line.
__________________ Mike |
| |
04-03-2007, 01:13 AM
|
#27 (permalink)
| | Salchester
Join Date: Jul 2005 Location: In a house
Posts: 230
| PHP:Save MySQL Database SDE,
Now how do I read what's in the file, and display the "Name" inside a text box, and the "Sex" using normal text on the page?
Many Thanks,
__________________ Many Thanks, in advance! Salchester.
The Future Is Here - Are You Ready? |
| |
04-03-2007, 01:38 AM
|
#28 (permalink)
| | Moderator
Join Date: May 2002 Location: us.ca
Posts: 4,532
| do you ever go through the php manual? i am usually not a big fan of rtfm replies but the php manual is a huge resource with lots of examples and user comments.
there's a lot of ways to do it.. check these out PHP: fgets - Manual PHP: file - Manual PHP: file_get_contents - Manual (php5)
__________________ Mike |
| |
04-03-2007, 01:43 AM
|
#29 (permalink)
| | Newbie
Join Date: Jun 2002 Location: Denmark
Posts: 1,726
| I would suggest to use \t as delimitor, since a user with mallicius intentions could easily write ';' as a name... But it's a wee bit harder to write <tab> into an input field, where <tab> means jump to next active field.
And by the way Salch, it isn't ill seen to think for one self, on the other hand, it is ill seen, in the long run, to require others do the thinking for you. |
| |
04-03-2007, 04:17 AM
|
#30 (permalink)
| | Senior Contributor
Join Date: Mar 2005
Posts: 745
| Quote:
Originally Posted by sde do you ever go through the php manual? i am usually not a big fan of rtfm replies but the php manual is a huge resource with lots of examples and user comments. | Indeed i already got annoyed. I'm outta here (this topic)
__________________ 
UT: Ultra-kill... God like! |
| | | Thread Tools | | | | Display Modes | Linear Mode |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | All times are GMT -8. The time now is 10:46 PM. |
Copyright © 2000-2008, Milano Interactive Web Hosting provided by Portal 360 Web Hosting |  | |