944,113 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 7440
  • PHP RSS
Feb 26th, 2005
0

Having roblems using PHP to send info as text file

Expand Post »
I need help. Does anyone have a script that will take info from a booking form that is used to select a particular course at a particular time on a partiular day and send it to the administrator as a text file and notify the administrator by email. Does anyone have a script tht can do this please. :rolleyes: :cry:
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
tony27 is offline Offline
4 posts
since Feb 2005
Feb 26th, 2005
0

Re: Having roblems using PHP to send info as text file

can you explain what you need in a little more detail

http://www.daniweb.com/techtalkforum...html#post81744

here is an example of emailing yourself with php, perhaps you can modify it to fit your needs
Reputation Points: 13
Solved Threads: 4
Posting Whiz
paradox814 is offline Offline
351 posts
since Oct 2004
Feb 27th, 2005
0

Re: Having roblems using PHP to send info as text file

Hi paradox814,

Thanks for your code.
I am trying to create an order form where clients select a course or several courses from several dropdown boxes and send the info to me. I would like that informaion to be written to a texfile on my computer but i would like to receive an email notifying me that someone has booked a course.

I have got the email part working but each time i add the code for the file to be sent as a text file i get error messages.

I have also got validations problems as i would like an order to have 2 courses booked on the same day at the same time. My courses run in blocks of 30 days but at different times. So a client could book 2 different courses on the same day but not at the same time.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
tony27 is offline Offline
4 posts
since Feb 2005
Feb 27th, 2005
0

Re: Having roblems using PHP to send info as text file

make sure the text file you are writing to has permissions of 777 that way you can write to it. If it does not have 777 access php will not have access to it.
I am guessing it is very important for security reasons that your text file not be in public_html or www folder so try to avoid putting it there if you can. This is for a linux server if you are usign windows then good luck I can't help you there.

PHP Syntax (Toggle Plain Text)
  1. $fp = "/private/classes.txt";
  2. $fp = use fopen ($file_location, 'a+');
  3.  
  4. $some_string = "\ni want this stuff written to my file la di dah\n";
  5. $fputs($fp, $some_string);
  6. $fclose($fp);

Quote ...
'r' - Open for reading only; place the file pointer at the beginning of the file.

'r+' - Open for reading and writing; place the file pointer at the beginning of the file.

'w' - Open for writing only; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.

'w+' - Open for reading and writing; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.

'a' - Open for writing only; place the file pointer at the end of the file. If the file does not exist, attempt to create it.

'a+' - Open for reading and writing; place the file pointer at the end of the file. If the file does not exist, attempt to create it.
Reputation Points: 13
Solved Threads: 4
Posting Whiz
paradox814 is offline Offline
351 posts
since Oct 2004
Feb 27th, 2005
0

Re: Having roblems using PHP to send info as text file

as far as making sure the times don't overlap you could use the time() and assign a begin time and an end time for every class that way

then use a while loop and do a sequential search to see if it overlaps with any other class
Reputation Points: 13
Solved Threads: 4
Posting Whiz
paradox814 is offline Offline
351 posts
since Oct 2004
Feb 27th, 2005
0

Re: Having roblems using PHP to send info as text file

Quote originally posted by paradox814 ...
as far as making sure the times don't overlap you could use the time() and assign a begin time and an end time for every class that way

then use a while loop and do a sequential search to see if it overlaps with any other class
Thanks man :lol: I will do that and see what hapens
Reputation Points: 10
Solved Threads: 0
Newbie Poster
tony27 is offline Offline
4 posts
since Feb 2005
Feb 27th, 2005
0

Re: Having roblems using PHP to send info as text file

Also I am on windows so i think i might need the luck there. will post the code tomorow to let you see where I am gion wrong
Reputation Points: 10
Solved Threads: 0
Newbie Poster
tony27 is offline Offline
4 posts
since Feb 2005
Mar 22nd, 2005
0

Re: Having roblems using PHP to send info as text file

Quote originally posted by tony27 ...
I need help. Does anyone have a script that will take info from a booking form that is used to select a particular course at a particular time on a partiular day and send it to the administrator as a text file and notify the administrator by email. Does anyone have a script tht can do this please. :rolleyes: :cry:
There are several classes/functions out there that can help with the actual attachment to email process. Try hotscripts.com etc.

Then take the form contents and fwrite them to the server (php.net/fwrite) and use the above class to attach the file you wrote as a text file on the server. You can get crazy and make it a csv or even tab delimited so that the prof's spreadsheet program opens it automatically.

Reputation Points: 15
Solved Threads: 0
Junior Poster in Training
barnamos is offline Offline
50 posts
since Mar 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: PHP/SQL query help
Next Thread in PHP Forum Timeline: instant calculcated quote form





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC