| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| NamePros Member Join Date: May 2005 Location: Cheshire, England
Posts: 49
![]() | i am also in need of php help :( imjust bstarting to learn php, and i would like some help on appending a file using a form. e.g i have index.php in my browser and it has a text field on it i want whatever is in the text field to write to the file test.txt this is the current code i have (dont laugh plz, this is the second day ive tryed and learnt php (about the 3rd hour)) PHP Code: Inf
__________________ http://www.InfernalGFX.co.uk // Nearing Completion |
| |
| | #2 (permalink) |
| Senior Member Join Date: Jul 2004 Location: Kizmiaz
Posts: 1,091
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Take a look at the example in the manual: http://ph.php.net/manual/en/function.fopen.php Also try not to mix your PHP and Html. It's better to get into good habits earlier rather than later ![]() Lux PS: you've got the variable $txt but you're never writing anything to it...
__________________ 1 Cent Web Hosting @ Online HostGatorVoucher.com Adsense Hack for Vbulletin - Fully 3.6 Compatible ForexArea.com Free E-Course in Programming EA's |
| |
| | THREAD STARTER #3 (permalink) |
| NamePros Member Join Date: May 2005 Location: Cheshire, England
Posts: 49
![]() | okay i know all of that on the link you gave me, its kinda not what i asked. can anyone else help me? theres a script called cutenews that uses this method. ive been looking at its php and i cant figure out how it works if nobody can help then nevermind thanks anywayInf
__________________ http://www.InfernalGFX.co.uk // Nearing Completion |
| |
| | #4 (permalink) |
| DNOA Member Join Date: May 2004
Posts: 5,040
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | PHP Code: |
| |
| | #5 (permalink) |
| Eating Pie Join Date: Nov 2004 Location: Canada
Posts: 2,272
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Next code you will need is the writing code. There are many different ways of doing this mind you. As well if this isn't private information txt file is fine if it is try finding another format such as .db or try adding none viewing into htaccess Anyways the code for the fwrite you can learn at http://www.php.net/fwrite This fwrite function is the function which writes to an opened file. Also make sure you chmod the file text.txt to 777. Best of luck. Please post when you finsh your project!
__________________ I feel old. |
| |
| | #6 (permalink) |
| Senior Member Join Date: Mar 2005
Posts: 4,948
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | PHP Code: |
| |
| | #7 (permalink) | ||||
| Eating Pie Join Date: Nov 2004 Location: Canada
Posts: 2,272
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
That may work but you should verify that the fields are actually there.. Here is a fixed version of your code. PHP Code: Wish you the best of luck.
__________________ I feel old. | ||||
| |
| | THREAD STARTER #8 (permalink) |
| NamePros Member Join Date: May 2005 Location: Cheshire, England
Posts: 49
![]() | okay if my SEMI WORKING database does not work i will try using all of the versions you guys have posted, but i just coded this and it partially works. feel free to try it out, it appends files quite well i guess, needs tweaking though, thanks for the help guys PHP Code: EDIT:-----> okay i have done it, and it is currently under further development eventually ill have a full script for use with the templates i will be selling ![]() a sample of the script is...... http://www.infernalgfx.co.uk/tests/p...ffdb2/form.php just write something in the box and submit it, it then takes you to a screen confirming what you just wrote (this is the form that actually adds to the database). once you have wrote to that click this link: http://www.infernalgfx.co.uk/tests/p...ffdb2/test.txt and it shows what you just wrote (at the bottom and encoded in html(if you ctrl+a to select it all and paste it into dreamweaver or front page you will see it in a graphical view)) ????: NamePros.com http://www.namepros.com/showthread.php?t=114240 thanks ![]() Inf
__________________ http://www.InfernalGFX.co.uk // Nearing Completion
Last edited by Infernal; 08-10-2005 at 08:05 PM.
|
| |
| | #10 (permalink) |
| NamePros Regular Join Date: Mar 2005
Posts: 912
![]() ![]() ![]() ![]() ![]() | try using the the mode a+ when you assigning the file handler.
__________________ Live Support : Zubair11 [at] hotmail.com Free SEO Directory! || Free Online TV || Tech Blog Web Design & Web Development Services || Reliable Web Hosting |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Tutorial: Getting started with PHP (The Basics) | deadserious | Webmaster Tutorials | 60 | 11-17-2007 12:35 PM |
| Googlism - What does google think of you? | deadserious | The Break Room | 55 | 12-15-2005 10:09 AM |
| Beware of PHP! | PolurNET | The Break Room | 25 | 03-29-2005 04:04 PM |