Hi all,
I know enough to be dangerous, but not enough to figure this out without some help.
I have a form which posts to a php script and writes a file with user data to the server and it works fine if I include the entire text of the html confirmation page in the write() function.
Problem is, I have lots and lots of if...elses and I don't want my script to be a mile and a half long when it doesn't have to be.
What I would like to do, is have the html confirmation page, which is the same every time, but needs to accept variables, be a separate file that gets read into the script and ultimately written to the new file called with the write() function.
I'm including a snippet of code, since I'm sure that I'm not wording what I need to happen clearly enough.
==================
Here's what I'm trying, but loses the user's post data somewhere...
If I replace "$regpagetext" in the write() function with the actual html text of the confirmation page everything works fine and I have no data loss. Help?
//Fair Play Soccer Levels 1 and 2
elseif ($progName=="Fair Play for Kids Soccer (#S101)" or $progName=="Fair Play for Kids Soccer (#S102)"
or $progName=="Fair Play for Kids Soccer (#S103)" or $progName=="Fair Play for Kids Soccer (#S201)" or
$progName=="Fair Play for Kids Soccer (#S202)" or $progName=="Fair Play for Kids Soccer (#S203)")
{
$datestamp = date("mdYhis"); //sets unique filename based on date and time
$bodyDate = date("m d Y h:i:s"); //sets date for inclusion in the body
$newfile = fopen("../mydirectory/registrations/$datestamp.html","w+"); //creates and opens a new file on the server
$billTotal = 50;
$regpagetext = readfile("../inc/registration.inc","a");
fwrite($newfile,$regpagetext);
fclose($newfile);
}
=====================
THANK YOU!