I am trying to save the entire form and data into a file. I am currently using the following code to save the file but would like to either save the entire form or save data to a template form and save it local. I have tried using a email template however the template is emailed to me but there is no data in the template.
<?PHP
###################### Set up the following variables ######################
# #
$filename = "registration_forms/$date.txt"; #CHMOD to 666
$forward = 0; # redirect? 1 : yes || 0 : no
$location = "thankyou.htm"; #set page to redirect to, if 1 is above
$now = date("H-i-s_m-d-y");
# #
##################### No need to edit below this line ######################
## set time up ##
$date = date ("l, F jS, Y");
$time = date ("h:i A");
## mail message ##
$msg = "Below is the result of your feedback form. It was submitted on $date at $time.\n\n";
foreach ($_POST as $key => $value)
{
$msg .= ucfirst ($key) ." : ". $value . "\n";
}
$msg .= "-----------\n\n";
$fp = fopen ("registration_forms/$now.txt", "a"); # w = write to the file only, create file if it does not exist, discard existing contents
if ($fp) {
fwrite ($fp, $msg);
fclose ($fp);
}
else {
$forward = 2;
}
if ($forward == 1) {
header ("Location:$location");
}
else if ($forward == 0) {
echo ("Thank you for submitting our form. We will get back to you as soon as possible.");
}
else {
"Error processing form. Please contact the webmaster";
}
?>
<?PHP
###################### Set up the following variables ######################
# #
$filename = "registration_forms/$date.txt"; #CHMOD to 666
$forward = 0; # redirect? 1 : yes || 0 : no
$location = "thankyou.htm"; #set page to redirect to, if 1 is above
$now = date("H-i-s_m-d-y");
# #
##################### No need to edit below this line ######################
## set time up ##
$date = date ("l, F jS, Y");
$time = date ("h:i A");
## mail message ##
$msg = "Below is the result of your feedback form. It was submitted on $date at $time.\n\n";
foreach ($_POST as $key => $value)
{
$msg .= ucfirst ($key) ." : ". $value . "\n";
}
$msg .= "-----------\n\n";
$fp = fopen ("registration_forms/$now.txt", "a"); # w = write to the file only, create file if it does not exist, discard existing contents
if ($fp) {
fwrite ($fp, $msg);
fclose ($fp);
}
else {
$forward = 2;
}
if ($forward == 1) {
header ("Location:$location");
}
else if ($forward == 0) {
echo ("Thank you for submitting our form. We will get back to you as soon as possible.");
}
else {
"Error processing form. Please contact the webmaster";
}
?>
Hi,
Please put here your template code with your HTML code so we can see it
Cheers
Max
Please put here your template code with your HTML code so we can see it
Cheers
Max
Ok I got the email template working exactly how I want it now I would like the same email basically saved to a flat file. Here is my template data. Can you tell me where within your script is it calling the data to be put into the template than emailed?
<TABLE height=376 cellSpacing=0 cellPadding=0 border=1>
<TBODY>
<TR>
<TD vAlign=top borderColor=#000000 align=middle height=42><DIV align=center></DIV></TD></TR>
<TR>
<TD borderColor=#000000 height=42>
<P
style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; WORD-SPACING: 0px; LINE-HEIGHT: 100%"
align=center><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"><B>ST.
CHARLES COUNTY YOUTH SOCCER ASSOCIATION (SCCYSA)</B></SPAN></P>
<P
style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; WORD-SPACING: 0px; LINE-HEIGHT: 100%"
align=center><font color="#0000FF"><B><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">*<SPAN
style="mso-spacerun: yes"> </SPAN>THIS FORM IS FOR
RECREATIONAL ONLINE
ONLY<SPAN style="mso-spacerun: yes"> </SPAN>*</SPAN></B></font></P>
<P
style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; WORD-SPACING: 0px; LINE-HEIGHT: 100%"
align=center><SPAN style="FONT-FAMILY: Times New Roman"><FONT
size=1><B>FORM MUST BE SUBMITTED BY JANUARY 19, 2007 </B></FONT></SPAN></P>
<P
style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; WORD-SPACING: 0px; LINE-HEIGHT: 100%"
align=center><FONT size=1><B><SPAN
style="FONT-FAMILY: Times New Roman; mso-fareast-font-family: Times New Roman; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">NOTE:
This form must be <font color="#0000FF"> <U>filled out completely</U></font></SPAN><font color="#0000FF"><SPAN
style="FONT-FAMILY: Times New Roman"><U> ONLINE</U></SPAN></font><SPAN
style="FONT-FAMILY: Times New Roman; mso-fareast-font-family: Times New Roman; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">
or it will not be accepted. <font color="#008000">Please review each field before
submitting.</font></SPAN></B></FONT><B><SPAN
style="FONT-FAMILY: Times New Roman; mso-fareast-font-family: Times New Roman; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"><FONT
size=1> </FONT></SPAN></B></P>
<P
style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; WORD-SPACING: 0px; LINE-HEIGHT: 100%"
align=center><B><FONT size=1><SPAN
style="FONT-FAMILY: Times New Roman; mso-fareast-font-family: Times New Roman; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">All
NEW players must FAX a copy of Birth Certificate to (636)
498-5485,</SPAN></FONT></B><SPAN
style="FONT-FAMILY: Times New Roman; mso-fareast-font-family: Times New Roman; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"><FONT
size=1><B>or mail to: </B></FONT></SPAN><B><SPAN
style="FONT-FAMILY: Times New Roman; mso-fareast-font-family: Times New Roman; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"><FONT
size=1>SCCYSA 221 Spencer Rd. Suite A St. Peters, MO
63376 </FONT></SPAN></B></P></TD></TR>
<TR>
<TD height=42>
<P
style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; WORD-SPACING: 0px; LINE-HEIGHT: 100%"><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"><B>Birth
Certificate state filing number<SPAN style="mso-spacerun: yes">
</SPAN>(ex.
124-94-000000):</B> <U>{Birth_Certificate_Number}</U></SPAN></P>
<P
style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; WORD-SPACING: 0px; LINE-HEIGHT: 100%"> </P></TD></TR>
<TR>
<TD height=23><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">First
Name: <U>{firstname}</U>
MI: <U>{mi}</U>
Last
Name: <U>{lastname}</U>
Birth date:</SPAN><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: Times New Roman; mso-fareast-font-family: Times New Roman; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"> <U>{dob}</U> </SPAN></TD>
</TR>
<TR>
<TD height=23><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">Street
Address: <U>{address1}</U&NBSP;&NBSP;
City: <u >{city}</U>
, <B>MO </B>Zip Code:</SPAN><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: Times New Roman; mso-fareast-font-family: Times New Roman; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"> <U>{zip}</U> </SPAN></TD></TR>
<TR>
<TD height=23>School: <U>{school}</U>
Grade:<FONT size=2><SPAN
style="FONT-FAMILY: Arial; mso-bidi-font-size: 9.0pt; mso-bidi-font-weight: normal"> <U>{grade}</U>
</SPAN></FONT> Last Season
Played: <U>{lastplayed}</U>
</TD></TR>
<TR>
<TD height=23><FONT size=2><B><SPAN
style="FONT-FAMILY: Times New Roman; mso-fareast-font-family: Times New Roman; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">EMAIL
ADDRESS:</SPAN></B></FONT><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: Times New Roman; mso-fareast-font-family: Times New Roman; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"> <U>{email}</U>
</SPAN><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: Times New Roman; mso-fareast-font-family: Times New Roman; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">
Gender:</SPAN><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"> <U>{sex}</U>
Home
Phone: <U>{phone}</U>
</SPAN></TD></TR>
<TR>
<TD height=19>
<P align=center>*</P></TD></TR>
<TR>
<TD height=23>
<P align=center><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">Coach's
name from <b>FALL</b></SPAN><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: Times New Roman"><B> '06</B>
</SPAN><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"> Season: <U>{coach}</U>
Team Number:</SPAN><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: Times New Roman; mso-fareast-font-family: Times New Roman; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"> <U>{team}</U> </SPAN></P></TD></TR>
<TR>
<TD height=23>
<P align=center><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">Do
you wish to remain on same team?</SPAN><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: Times New Roman; mso-fareast-font-family: Times New Roman; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">
(Even if Coach does not
return) <U>{sameteam}</U> </SPAN></P></TD></TR>
<TR>
<TD height=26>
<P
style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; WORD-SPACING: 0px; LINE-HEIGHT: 100%"
align=center><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">If
<B>NO</B>, do you have a request? Coach's
Name: <U>{newcoach}</U>
Team Number:</SPAN><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: Times New Roman; mso-fareast-font-family: Times New Roman; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"> <U>{newteam}</U> </SPAN></P></TD></TR>
<TR>
<TD height=34><b><font size="2">***THERE WILL BE AN ADDITIONAL $10.00 CHARGE
WHEN REQUESTING TO CHANGE TEAMS FOR A NEW UNIFORM***</font></b></TD></TR>
<TR>
<TD height=34>
<P
style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; WORD-SPACING: 0px; LINE-HEIGHT: 100%"><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: Times New Roman; mso-fareast-font-family: Times New Roman; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">List
</SPAN><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">of
other Children (and ages) from family presently in
league: <U>{otherchildren}</U>
</SPAN></P>
<P
style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; WORD-SPACING: 0px; LINE-HEIGHT: 100%"> </P></TD></TR>
<TR>
<TD height=31><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">Father's
Name: <U>{father}</U>
Cell
Phone: <U>{fatherocc}</U>
Bus Phone:</SPAN><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: Times New Roman; mso-fareast-font-family: Times New Roman; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"> <U>{fatherph}</U> </SPAN></TD>
</TR>
<TR>
<TD height=34>
<P
style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; WORD-SPACING: 0px; LINE-HEIGHT: 100%"><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">Mother's
Name: <U>{mother}</U>
Cell
Phone: <U>{motherocc}</U>
Bus
Phone: <U>{motherph}</U> </SPAN></P></TD></TR>
<TR>
<TD height=27>
<P align=right><SPAN
style="FONT-FAMILY: Times New Roman; mso-fareast-font-family: Times New Roman; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-bidi-font-size: 12.0pt"><FONT
size=3>Parent
Support: <U><SUPPORT></U> </FONT></SPAN></P></TD></TR>
<TR>
<TD height=18>
<P
style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; WORD-SPACING: 0px; LINE-HEIGHT: 100%"
align=left>In an emergency when parent/guardian cannot be reached, please
contact the following:</P>
<P
style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; WORD-SPACING: 0px; LINE-HEIGHT: 100%"
align=left><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: Times New Roman; mso-fareast-font-family: Times New Roman; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">Name</SPAN><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">: <U>{emergency}</U>
Home Phone: <U>{emerph}</U>
Bus
Phone: <U>{emerph2}</U> </SPAN></P></TD></TR>
<TR>
<TD height=18><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: Times New Roman; mso-fareast-font-family: Times New Roman; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">Allergies: <U>{allergies}</U>
Other Medical
Conditions: <U>{medical}</U> </SPAN></TD></TR>
<TR>
<TD height=18>
<P align=center><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: Times New Roman; mso-fareast-font-family: Times New Roman; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">*</SPAN></P></TD></TR>
<TR></U> </SPAN></TD>
<TD><SPAN
style="FONT-SIZE: 11pt; mso-bidi-font-size: 12.0pt"><B>Phone w/ area
code:</B> <U><DOCP
<TD height=18>
<H5
style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; WORD-SPACING: 0px; LINE-HEIGHT: 100%"
align=center>EMERGENCY MEDICAL TREATMENT AUTHORIZATION<SPAN
style="FONT-SIZE: 11pt; mso-bidi-font-size: 12.0pt"><O:P> </SPAN></H5>
<DIV align=center>
<CENTER>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD><SPAN
style="FONT-SIZE: 11pt; mso-bidi-font-size: 12.0pt"><B>Physicians
Name:</B> <U>{physician}</U>
<O:P> </SPAN></TD>
</TR>
<TR>
<TD>
<SPAN
style="FONT-SIZE: 11pt; mso-bidi-font-size: 12.0pt"><B>Insurance
Company:</B> <U>{insurance}</U> </SPAN></TD>
<TD><SPAN
style="FONT-SIZE: 11pt; mso-bidi-font-size: 12.0pt"><B>Phone w/ area
code: </B> <U>{insph}</u></SPAN></TD>
</TR>
<TR>
<TD><SPAN
style="FONT-SIZE: 11pt; mso-bidi-font-size: 12.0pt"><B>Policy
Holder's
Name:</B> <U>{policyname}</u>
<SPAN style="mso-tab-count: 1">
</SPAN></SPAN></TD>
<TD><SPAN
style="FONT-SIZE: 11pt; mso-bidi-font-size: 12.0pt"><B>Policy
Number:</B> <U>{number}</U>
</SPAN><SPAN
style="FONT-SIZE: 8pt; mso-bidi-font-size: 12.0pt"><O:P>
</SPAN></TD></TR></TBODY></TABLE></CENTER></DIV>
<H5
style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; WORD-SPACING: 0px; LINE-HEIGHT: 100%"
align=center><SPAN
style="FONT-SIZE: 11pt; mso-bidi-font-size: 12.0pt">
</O:P></SPAN></H5></TD></TR>
<TR>
<TD height=18>
<P align=center><B><SPAN
style="FONT-SIZE: 11pt; mso-bidi-font-size: 12.0pt">
*</SPAN></B><SPAN
style="FONT-SIZE: 11pt; mso-bidi-font-size: 12.0pt"><B> </B></SPAN></P></TD></TR>
<TR>
<TD height=18><B>I have read, understood, and agree to the Medical
Treatment Authorization:</B>
<P><B><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-size: 12.0pt">PARENT OR
LEGAL GUARDIAN INITIAL:</SPAN></B><FONT size=4><SPAN
style="mso-bidi-font-size: 12.0pt"> <U>{emt}</U>
</SPAN></FONT><SPAN style="mso-bidi-font-size: 9.0pt"><FONT
size=4>
</FONT><B>Relationship:</B> <U>{relationship2}</U> <B>
Date:</B> <U>{date}</U> </SPAN></P></TD></TR>
<TR>
<TD height=18>
<P align=center><B><SPAN
style="mso-bidi-font-size: 9.0pt">*</SPAN></B></P></TD></TR>
<TR>
<TD height=18>
<P align=center><B>SCCYSA PARENTS/PLAYERS MUST ABIDE BY THE PRINCIPLES OF
CONDUCT</B></P></TD></TR>
<TR>
<TD height=18>
<P align=center><B>*</B></P></TD></TR>
<TR>
<TD height=18><B>I have read, understood, and agree to the Principles of
Conduct :</B>
<P><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-size: 12.0pt"><B>PARENT OR
LEGAL GUARDIAN INITIAL:</B></SPAN><FONT size=4><SPAN
style="mso-bidi-font-size: 12.0pt"> <U>{conduct}</U> </SPAN></FONT></P></TD></TR></TBODY></TABLE>
Hi,
From my reading of the code you are looking for the $body variable from the e-mail code. There's a line
Bob
From my reading of the code you are looking for the $body variable from the e-mail code. There's a line
$body = $html_message;
near the end of chronocontact.html.php (it's in two different places so probably after then end of the 'if' clauses is a good place to pick it up. I'd try right before the onSubmit code. if ( !empty($rows[0]->onsubmitcode) ) {
eval( "?>".$rows[0]->onsubmitcode );
}
Bob
Hi jbourque, Bob,
If you are looking about the place where the new body of the email is generated then its just as Bob referenced, but you will have somethings added like the IP if you turned it on, If you need the original fresh code "just" made, its at line 114
but you must access it at line 117 so its complete!
all this at file chronocontact.php :side:
Cheers
Max
If you are looking about the place where the new body of the email is generated then its just as Bob referenced, but you will have somethings added like the IP if you turned it on, If you need the original fresh code "just" made, its at line 114
$html_message = preg_replace($pattern, $replace, $emailbodytemplate);
but you must access it at line 117 so its complete!
all this at file chronocontact.php :side:
Cheers
Max
Bob and Max,
I tried to add a fopen to open a new text file then put in $html_message then close it but that did not work.
Do either of you have a thought about how I would take the template and even save it as a htm file just like the email that is being sent to me.
I tried to add a fopen to open a new text file then put in $html_message then close it but that did not work.
Do either of you have a thought about how I would take the template and even save it as a htm file just like the email that is being sent to me.
Max,
On line 117 I added the following:
$now = date("H-i-s_m-d-y");
$fp = fopen (registration_forms/$now.htm, "a");
if ($fp) {
fwrite ($fp, $html_message);
fclose ($fp);
}
However it's not doing anything. I would appreciate some help if anyone knows how to take $html_message and put it into a file
On line 117 I added the following:
$now = date("H-i-s_m-d-y");
$fp = fopen (registration_forms/$now.htm, "a");
if ($fp) {
fwrite ($fp, $html_message);
fclose ($fp);
}
However it's not doing anything. I would appreciate some help if anyone knows how to take $html_message and put it into a file
Hi,
I tried this
and it appears to work perfectly. Two changes from your code - I added $mosConfig_absolute_path and changed the folder to one that I knew was writeable. Oh and I substituted '$body' as I put the code right near the end (my code is re-factored and line 117 is something different).
If this works for you then the problem could be is likely to be that either the path isn't accessible or the folder isn't writeable.
Bob<br><br>Post edited by: GreyHead, at: 2007/06/05 11:21
I tried this
$now = date("H-i-s_m-d-y");
$fp = fopen ("$mosConfig_absolute_path/administrator/backups/$now.htm", "a");
if ( $fp ) {
// echo "File exists"; /* debug code to check we are inside the 'if' */
fwrite ($fp, $body);
fclose ($fp);
}
and it appears to work perfectly. Two changes from your code - I added $mosConfig_absolute_path and changed the folder to one that I knew was writeable. Oh and I substituted '$body' as I put the code right near the end (my code is re-factored and line 117 is something different).
If this works for you then the problem could be is likely to be that either the path isn't accessible or the folder isn't writeable.
Bob<br><br>Post edited by: GreyHead, at: 2007/06/05 11:21
jbourque,
Yes, Bob is right, you have to include full physical path at these situations, did you try Bob's approach ?
Cheers
Max
Yes, Bob is right, you have to include full physical path at these situations, did you try Bob's approach ?
Cheers
Max
Bob and Max you guys ROCK it is working pefectly. I removed the email submit code so it only saves the form.
Thanks for all the help. Now I am trying to retreive the lastname variable so I can have the forms saved in a name that makes since and is easy to retreive.
I will get a license from you guys thanks again for the help.
Thanks for all the help. Now I am trying to retreive the lastname variable so I can have the forms saved in a name that makes since and is easy to retreive.
I will get a license from you guys thanks again for the help.
Try $_POST[$lastname] - that should give it to you. Bob
Later: yes, that should be $_POST['lastname'], sorry. I copied it from the wrong part of the code.<br><br>Post edited by: GreyHead, at: 2007/06/05 19:09
Later: yes, that should be $_POST['lastname'], sorry. I copied it from the wrong part of the code.<br><br>Post edited by: GreyHead, at: 2007/06/05 19:09
Thanks I had just got it I used
$lname = $_POST['lastname'];
Thanks again.
Joe
$lname = $_POST['lastname'];
Thanks again.
Joe
Bob,
Hope all is well.
I need your help again I have updated to the latest version to be able to use the authorize.net pluggin and now I have undone my changes which saves my files local instead of having them emailed.
I have gone through the new chronocontact.php but it appears to have been completely rewritten can you give me some advice to get the new version worked out.
Thanks
Joe
Hope all is well.
I need your help again I have updated to the latest version to be able to use the authorize.net pluggin and now I have undone my changes which saves my files local instead of having them emailed.
I have gone through the new chronocontact.php but it appears to have been completely rewritten can you give me some advice to get the new version worked out.
Thanks
Joe
Bob,
I found it now I need to figure out why the authorize.net is not working😟
Joe
I found it now I need to figure out why the authorize.net is not working😟
Joe
Hi Joe,
As you saw Max has completely re-written ChronoForms a couple of times now.
I've no idea why the authorise.net plugin isn't working - what problem are you seeing?
Bob
As you saw Max has completely re-written ChronoForms a couple of times now.
I've no idea why the authorise.net plugin isn't working - what problem are you seeing?
Bob
Bob,
If your still around could really use some help. I recently upgraded my client to Joomla 1.5 and upgraded Chronoform only to find out that I forgot about this problem and requirement. I am trying to do that same exact thing in the latest chronoform where I write the form to a flat file instead of emailing the form.
Any help with this would be awesome
Joe
If your still around could really use some help. I recently upgraded my client to Joomla 1.5 and upgraded Chronoform only to find out that I forgot about this problem and requirement. I am trying to do that same exact thing in the latest chronoform where I write the form to a flat file instead of emailing the form.
Any help with this would be awesome
Joe
Hi Joe,
What was your old code ? there should not be big differences
Regards
Max
What was your old code ? there should not be big differences
Regards
Max
Max,
I am looking to add the following but I see the info in the new chronocontact.php file
As you can see I replaced the email submit to generate a file instead of emailing the form.
* E-mail the results - 'Yes' custom
*/
if ( $debug) { echo "E-mail: 'Yes' custom<br />"; }
$body = $html_message;
}
}
if(!empty($rows[0]->onsubmitcode)){
eval( "?>".$rows[0]->onsubmitcode );
}
if(!empty($rows[0]->autogenerated)){
eval( "?>".$rows[0]->autogenerated );
}
$now = date("H-i-s_m-d-y");
$lname = $_POST['lastname'];
$fname = $_POST['firstname'];
$fp = fopen ("registration_forms/$lname+$fname+$formname.htm", "a");
if ( $fp ) {
// echo "File exists"; /* debug code to check we are inside the 'if' */
fwrite ($fp, $body);
fclose ($fp);
Thanks for you help
Joe
I am looking to add the following but I see the info in the new chronocontact.php file
As you can see I replaced the email submit to generate a file instead of emailing the form.
* E-mail the results - 'Yes' custom
*/
if ( $debug) { echo "E-mail: 'Yes' custom<br />"; }
$body = $html_message;
}
}
if(!empty($rows[0]->onsubmitcode)){
eval( "?>".$rows[0]->onsubmitcode );
}
if(!empty($rows[0]->autogenerated)){
eval( "?>".$rows[0]->autogenerated );
}
$now = date("H-i-s_m-d-y");
$lname = $_POST['lastname'];
$fname = $_POST['firstname'];
$fp = fopen ("registration_forms/$lname+$fname+$formname.htm", "a");
if ( $fp ) {
// echo "File exists"; /* debug code to check we are inside the 'if' */
fwrite ($fp, $body);
fclose ($fp);
Thanks for you help
Joe
Hi Joe,
I see, you can place the same code in the "on submit after email" code box to do the same task but remove this block of code:
Regards
Max
I see, you can place the same code in the "on submit after email" code box to do the same task but remove this block of code:
if(!empty($rows[0]->onsubmitcode)){
eval( "?>".$rows[0]->onsubmitcode );
}
if(!empty($rows[0]->autogenerated)){
eval( "?>".$rows[0]->autogenerated );
}
Regards
Max
Max,
Are you saying put the following code in the box within the form?
if ( $debug) { echo "E-mail: 'Yes' custom<br />"; }
$body = $html_message;
}
}
if(!empty($rows[0]->onsubmitcode)){
eval( "?>".$rows[0]->onsubmitcode );
}
if(!empty($rows[0]->autogenerated)){
eval( "?>".$rows[0]->autogenerated );
}
$now = date("H-i-s_m-d-y");
$lname = $_POST['lastname'];
$fname = $_POST['firstname'];
$fp = fopen ("registration_forms/$lname+$fname+$formname.htm", "a");
if ( $fp ) {
// echo "File exists"; /* debug code to check we are inside the 'if' */
fwrite ($fp, $body);
fclose ($fp);
Which file is the code you said I need to remove?
Joe
Are you saying put the following code in the box within the form?
if ( $debug) { echo "E-mail: 'Yes' custom<br />"; }
$body = $html_message;
}
}
if(!empty($rows[0]->onsubmitcode)){
eval( "?>".$rows[0]->onsubmitcode );
}
if(!empty($rows[0]->autogenerated)){
eval( "?>".$rows[0]->autogenerated );
}
$now = date("H-i-s_m-d-y");
$lname = $_POST['lastname'];
$fname = $_POST['firstname'];
$fp = fopen ("registration_forms/$lname+$fname+$formname.htm", "a");
if ( $fp ) {
// echo "File exists"; /* debug code to check we are inside the 'if' */
fwrite ($fp, $body);
fclose ($fp);
Which file is the code you said I need to remove?
Joe
Max,
I am putting the following in the On Submit Code after sending email
<?PHP
$now = date("H-i-s_m-d-y");
$lname = $_POST['lastname'];
$fname = $_POST['firstname'];
$fp = fopen ("registration_forms/$lname+$fname+$formname.htm", "a");
if ( $fp ) {
// echo "File exists"; /* debug code to check we are inside the 'if' */
fwrite ($fp, $body);
fclose ($fp);
###################### Set up the following variables ######################
# #
$filename = "registration/output.txt"; #CHMOD to 666
$forward = 0; # redirect? 1 : yes || 0 : no
$location = "thankyou.htm"; #set page to redirect to, if 1 is above
$now = date("H-i-s_m-d-y");
# #
##################### No need to edit below this line ######################
## set time up ##
$date = date ("l, F jS, Y");
$time = date ("h:i A");
## mail message ##
$msg = "Below is the result of your feedback form. It was submitted on $date at $time.\n\n";
foreach ($_POST as $key => $value)
{
$msg .= ucfirst ($key) ." : ". $value . "\n";
}
$msg .= "-----------\n\n";
$fp = fopen (registration_forms/$now.txt, "a"); # w = write to the file only, create file if it does not exist, discard existing contents
if ($fp) {
fwrite ($fp, $msg);
fclose ($fp);
}
else {
$forward = 2;
}
if ($forward == 1) {
header ("Location:$location");
}
else if ($forward == 0) {
echo ("Thank you for submitting our form. ALL COACHES, please make sure online Background Check is also filled out. Link is on the Coaches Corner page.");
}
else {
"Error processing form. Please contact the webmaster";
}
?>
However I am getting an error unexpected end
Joe
I am putting the following in the On Submit Code after sending email
<?PHP
$now = date("H-i-s_m-d-y");
$lname = $_POST['lastname'];
$fname = $_POST['firstname'];
$fp = fopen ("registration_forms/$lname+$fname+$formname.htm", "a");
if ( $fp ) {
// echo "File exists"; /* debug code to check we are inside the 'if' */
fwrite ($fp, $body);
fclose ($fp);
###################### Set up the following variables ######################
# #
$filename = "registration/output.txt"; #CHMOD to 666
$forward = 0; # redirect? 1 : yes || 0 : no
$location = "thankyou.htm"; #set page to redirect to, if 1 is above
$now = date("H-i-s_m-d-y");
# #
##################### No need to edit below this line ######################
## set time up ##
$date = date ("l, F jS, Y");
$time = date ("h:i A");
## mail message ##
$msg = "Below is the result of your feedback form. It was submitted on $date at $time.\n\n";
foreach ($_POST as $key => $value)
{
$msg .= ucfirst ($key) ." : ". $value . "\n";
}
$msg .= "-----------\n\n";
$fp = fopen (registration_forms/$now.txt, "a"); # w = write to the file only, create file if it does not exist, discard existing contents
if ($fp) {
fwrite ($fp, $msg);
fclose ($fp);
}
else {
$forward = 2;
}
if ($forward == 1) {
header ("Location:$location");
}
else if ($forward == 0) {
echo ("Thank you for submitting our form. ALL COACHES, please make sure online Background Check is also filled out. Link is on the Coaches Corner page.");
}
else {
"Error processing form. Please contact the webmaster";
}
?>
However I am getting an error unexpected end
Joe
Hey Max,
So I go the file being created but the file is empty nothing being written to it.
Here is what I am adding the on submit
So I go the file being created but the file is empty nothing being written to it.
Here is what I am adding the on submit
<?php
/* E-mail the results - 'Yes' custom
*/
if ( $debug) { echo "E-mail: 'Yes' custom<br />"; }
$body = $html_message;
$now = date("H-i-s_m-d-y");
$lname = $_POST['lastname'];
$fname = $_POST['firstname'];
$fp = fopen ("registration_forms/$lname+$fname+$formname.htm", "a");
if ( $fp ) {
// echo "File exists"; /* debug code to check we are inside the 'if' */
fwrite ($fp, $body);
fclose ($fp);
}
###################### Set up the following variables ######################
# #
$filename = "registration/output.txt"; #CHMOD to 666
$forward = 0; # redirect? 1 : yes || 0 : no
$location = "thankyou.htm"; #set page to redirect to, if 1 is above
$now = date("H-i-s_m-d-y");
# #
##################### No need to edit below this line ######################
## set time up ##
$date = date ("l, F jS, Y");
$time = date ("h:i A");
## mail message ##
$msg = "Below is the result of your feedback form. It was submitted on $date at $time.\n\n";
foreach ($_POST as $key => $value)
{
$msg .= ucfirst ($key) ." : ". $value . "\n";
}
$msg .= "-----------\n\n";
$fp = fopen (registration_forms/$now.txt, "a"); # w = write to the file only, create file if it does not exist, discard existing contents
if ($fp) {
fwrite ($fp, $msg);
fclose ($fp);
}
else {
$forward = 2;
}
if ($forward == 1) {
header ("Location:$location");
}
else if ($forward == 0) {
echo ("Thank you for submitting our form. ALL COACHES, please make sure online Background Check is also filled out. Link is on the Coaches Corner page.");
}
else {
"Error processing form. Please contact the webmaster";
}
?>
Max,
I believe I got it I could not add it to the on submit box I had to add it to the mails.php. I added the following
if ( $email->enabled == "1" )
$body = $email_body;
$regtype = $formname;
$now = date("H-i-s_m-d-y");
$lname = $_POST['lastname'];
$fname = $_POST['firstname'];
$fp = fopen ("registration_forms/$lname+$fname+$subject.htm", "a");
if ( $fp ) {
// echo "File exists"; /* debug code to check we are inside the 'if' */
fwrite ($fp, $body);
fclose ($fp);
}
And remarked out the /* $email_sent = JUtility::sendMail($from, $fromname, $recipients, $subject, $email_body, $mode, $ccemails, $bccemails, $this_attachments, $replyto_email, $replyto_name ); */
It appears to be working.
Joe
I believe I got it I could not add it to the on submit box I had to add it to the mails.php. I added the following
if ( $email->enabled == "1" )
$body = $email_body;
$regtype = $formname;
$now = date("H-i-s_m-d-y");
$lname = $_POST['lastname'];
$fname = $_POST['firstname'];
$fp = fopen ("registration_forms/$lname+$fname+$subject.htm", "a");
if ( $fp ) {
// echo "File exists"; /* debug code to check we are inside the 'if' */
fwrite ($fp, $body);
fclose ($fp);
}
And remarked out the /* $email_sent = JUtility::sendMail($from, $fromname, $recipients, $subject, $email_body, $mode, $ccemails, $bccemails, $this_attachments, $replyto_email, $replyto_name ); */
It appears to be working.
Joe
Hi Joe,
The code ought to work OK in the onSubmit box. The problem with hacking the core code is that you can easily forget when you update the site and lose your hack :-(
Two things with the OnSubmit boxes.
a) The OnSubmit Before code is not executed unless Emails are enabled on the General Tab.
b) ChronoForms forms can fail to save correctly (or at all) when there is PHP in the code boxes. To work around this problem include
Bob
The code ought to work OK in the onSubmit box. The problem with hacking the core code is that you can easily forget when you update the site and lose your hack :-(
Two things with the OnSubmit boxes.
a) The OnSubmit Before code is not executed unless Emails are enabled on the General Tab.
b) ChronoForms forms can fail to save correctly (or at all) when there is PHP in the code boxes. To work around this problem include
if ( !$mainframe->isSite() ) return;
before any other php.Bob
Bob,
The problem I was facing was I could not get the $email_body variable to populate the file will this solve that problem?
Joe
The problem I was facing was I could not get the $email_body variable to populate the file will this solve that problem?
Joe
This topic is locked and no more replies can be posted.