Having roblems using PHP to send info as text file

Reply

Join Date: Feb 2005
Posts: 4
Reputation: tony27 is an unknown quantity at this point 
Solved Threads: 0
tony27 tony27 is offline Offline
Newbie Poster

Having roblems using PHP to send info as text file

 
0
  #1
Feb 26th, 2005
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:
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 348
Reputation: paradox814 is an unknown quantity at this point 
Solved Threads: 4
paradox814's Avatar
paradox814 paradox814 is offline Offline
Posting Whiz

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

 
0
  #2
Feb 26th, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 4
Reputation: tony27 is an unknown quantity at this point 
Solved Threads: 0
tony27 tony27 is offline Offline
Newbie Poster

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

 
0
  #3
Feb 27th, 2005
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.
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 348
Reputation: paradox814 is an unknown quantity at this point 
Solved Threads: 4
paradox814's Avatar
paradox814 paradox814 is offline Offline
Posting Whiz

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

 
0
  #4
Feb 27th, 2005
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.

  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);

'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.
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 348
Reputation: paradox814 is an unknown quantity at this point 
Solved Threads: 4
paradox814's Avatar
paradox814 paradox814 is offline Offline
Posting Whiz

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

 
0
  #5
Feb 27th, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 4
Reputation: tony27 is an unknown quantity at this point 
Solved Threads: 0
tony27 tony27 is offline Offline
Newbie Poster

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

 
0
  #6
Feb 27th, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 4
Reputation: tony27 is an unknown quantity at this point 
Solved Threads: 0
tony27 tony27 is offline Offline
Newbie Poster

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

 
0
  #7
Feb 27th, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 50
Reputation: barnamos is an unknown quantity at this point 
Solved Threads: 0
barnamos's Avatar
barnamos barnamos is offline Offline
Junior Poster in Training

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

 
0
  #8
Mar 22nd, 2005
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.

Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC