| | |
Having roblems using PHP to send info as text file
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Feb 2005
Posts: 4
Reputation:
Solved Threads: 0
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:
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
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
•
•
Join Date: Feb 2005
Posts: 4
Reputation:
Solved Threads: 0
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.
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.
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.
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)
$fp = "/private/classes.txt"; $fp = use fopen ($file_location, 'a+'); $some_string = "\ni want this stuff written to my file la di dah\n"; $fputs($fp, $some_string); $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.
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
then use a while loop and do a sequential search to see if it overlaps with any other class
•
•
Join Date: Feb 2005
Posts: 4
Reputation:
Solved Threads: 0
•
•
•
•
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
•
•
•
•
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:
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.
![]() |
Similar Threads
Other Threads in the PHP Forum
- Previous Thread: PHP/SQL query help
- Next Thread: instant calculcated quote form
| Thread Tools | Search this Thread |
advanced alerts apache api archive array autosuggest beginner binary broken cakephp checkbox class clients cms code cron curl database date display dynamic echo email emptydisplayvalue eregi error execute explodefunction file files folder form forms function functions google hack href htaccess html if...loop image include insert ip javasciptvalidation javascript joomla keywords library limit link list login mail matching menu mlm multiple mysql object oop password paypal pdf php phpincludeissue query radio random recursive remote script search searchbox seo server sessions shot smarty source space speed sql syntax system table tutorial update upload url validator variable vbulletin video web webdesign website youtube





