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:

Recommended Answers

All 7 Replies

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.

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.

$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

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

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

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.

:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.