If volunteering for coaching, please fill in preferred training day and time. Please note that this is not a confirmation of this training time. Day {vday} Session {session} Time {time} Due to lack of gym space we ask that coaches be prepared to gym share Morning sessions must be finished by 830am, afternoon sessions must be finished by 430pm Options are also available for trainings in the Old Gym during Junior Lunch time (1200pm-1250pm)   Conditions of play   I am aware my son must purchase a pair of regulation Rosmini College playing shorts, available from the school stationery shop to be worn for games at a cost of $45 I am aware my son will be allocated a playing singlet which is his responsibility to care for during the season. THIS SINGLET IS NOT TO BE WORN FOR ANYTHING OTHER THAN BASKETBALL GAMES. I am aware that any cost for replacement due to damage or loss will be charged to me. I am aware my son will be expected to attend ALL trainings organised by his team coach throughout the season, save for exceptional circumstances which will be communicated to the coach and manager of his team. I am aware that my son will be expected to attend ALL games played on Mondays at the North Shore Event Centre or AUT Gymnasium between 400pm – 830pm throughout the season, save for exceptional circumstances that again need to communicated to his coach and manager. I am aware that there will be NO REFUND for my son if he registers, then decides that he wants to withdraw from his team. I have read and understand all the conditions that have been explained above {understandconditions} I give permission for my son to play basketball for Rosmini College in Semester 1 (Term 1 & 2) {permission}   Payment Instructions   Do you intend to enrol for Skills Sessions in Term 1 at $45 for the term? (This cost is separate to Player Registration costs) {skillsessions} Player registration ($115 for Semester 1) {registration} Payment Method {paymentmethod} Payment instructions: Bank details: BNZ Please use: Childs name ‘Registration’ & 78BBALL as the reference. i.e. J Smith – Registration – 78BBALL Payments must be made within five days of completing this form. Cash/cheques (payable to Rosmini College) must only be handed to Mr Samuels who will issue a receipt. PLEASE NOTE: NO MONEY CAN BE ACCEPTED AT THE TRIALS OR SKILL SESSIONS FOR PLAYER REGISTRATION. Please contact basketball@school.nz with any further queries. Please note: Registration and payments must be received by the … NO LATE REGISTRATIONS OR PAYMENTS CAN BE ACCEPTED. In case of financial hardship, sponsorship may be available on request. If you would like more information please tick the box. Financial assistance is for players who otherwise would not be able to play basketball at all for Rosmini College and have no opportunity to play basketball elsewhere. All correspondence will be strictly confidential. Yes, please send information with respect to financial support. "> Custom E-mail template: PHP issues - Forums

Forums

Custom E-mail template: PHP issues

rcadmin 20 Oct, 2014
Ok so I am doing something wrong.

The following template works just fine UNTIL I insert the PHP. I have got this right before (using an older version of CF)
<table width="100%">
  <tr>
    <td width="40%" ><strong>Student Details</strong></td>
    <td> </td>
  </tr>
  <tr>
    <td width="40%">First name</td>
    <td>{studentname}</td>
  </tr>
  <tr>
    <td width="40%">Surname</td>
    <td>{studentsurname}</td>
  </tr>
  <tr>
    <td width="40%">Address</td>
    <td>{address}</td>
  </tr>
  <tr>
    <td width="40%">Suburb</td>
    <td>{suburb}</td>
  </tr>
  <tr>
    <td width="40%">Postal Code</td>
    <td>{postalcode}</td>
  </tr>
  <tr>
    <td width="40%">Date of Birth</td>
    <td>{dob}</td>
  </tr>
  <tr>
    <td width="40%">School year in 2015</td>
    <td>{schoolyear}</td>
  </tr>
  <tr>
    <td colspan="2"><p> </p>
      <p><strong>Playing Experience</strong></p></td>
  </tr>
  <tr>
    <td width="40%">Played last year?</td>
    <td>{playedbefore}</td>
  </tr>
  <tr>
    <td width="40%">Rate your experience</td>
    <td>{experiencelevel}</td>
  </tr>
  <?php }
	if ( $_POST['playedbefore'] == "Yes" ) {
 
  ?>
  <tr>
    <td colspan="2"><p>If you played last year then complete the following:</p></td>
  </tr>
  <tr>
    <td width="40%">Team</td>
    <td>{team}</td>
  </tr>
  <tr>
    <td width="40%">League</td>
    <td>{league}</td>
  </tr>
  <?php } ?>
  <tr>
    <td width="40%"><p> </p>
      <p><strong>Parent Details</strong></p></td>
    <td> </td>
  </tr>
  <tr>
    <td width="40%">Name</td>
    <td>{parentname}</td>
  </tr>
  <tr>
    <td width="40%">E-mail</td>
    <td>{parentemail}</td>
  </tr>
  <tr>
    <td width="40%">Phone</td>
    <td>{parenthomephone}</td>
  </tr>
  <tr>
    <td width="40%">Parent Mobile</td>
    <td>{parentmobile}</td>
  </tr>
  <tr>
    <td width="40%">Volunteering</td>
    <td> </td>
  </tr>
  <tr>
    <td colspan="2"><p>Rosmini College is grateful for volunteer support.  Without this we are unable to enter teams into the Harbour Intermediate league.</p></td>
  </tr>
  <tr>
    <td width="40%">I am available to assist in the following way(s):</td>
    <td>{volunteeroptions}</td>
  </tr>
  <?php }
	if ( $_POST['volunteeroptions'] <> "" ) {
 
  ?>
  <tr>
    <td colspan="2"><p>If volunteering for coaching, please fill in preferred training day and time.  Please note that this is not a confirmation of this training time.</p></td>
  </tr>
  <tr>
    <td width="40%">Day</td>
    <td>{vday}</td>
  </tr>
  <tr>
    <td width="40%">Session</td>
    <td>{session}</td>
  </tr>
  <tr>
    <td width="40%">Time</td>
    <td>{time}</td>
  </tr>
  <?php } ?>
  <tr>
    <td colspan="2"><ul>
        <li>Due  to lack of gym space we ask that coaches be prepared to gym share</li>
        <li>Morning  sessions must be finished by 830am, afternoon sessions must be finished by  430pm</li>
        <li>Options  are also available for trainings in the Old Gym during Junior Lunch time  (1200pm-1250pm)</li>
      </ul></td>
  </tr>
  <tr>
    <td width="40%"><p> </p>
      <p><strong>Conditions of play</strong></p></td>
    <td> </td>
  </tr>
  <tr>
    <td colspan="2"><ul>
        <li>I am aware my son must purchase a  pair of regulation Rosmini College playing shorts, available from the school  stationery shop to be worn for games at a cost of $45</li>
        <li>I am aware my son will be allocated  a playing singlet which is his responsibility to care for during the season.  THIS SINGLET IS NOT TO BE WORN FOR ANYTHING OTHER THAN BASKETBALL GAMES. I am  aware that any cost for replacement due to damage or loss will be charged to  me.</li>
        <li>I am aware my son will be expected  to attend ALL trainings organised by his team coach throughout the season, save  for exceptional circumstances which will be communicated to the coach and  manager of his team.</li>
        <li>I am aware that my son will be  expected to attend ALL games played on Mondays at the North Shore Event Centre  or AUT Gymnasium between 400pm – 830pm throughout the season, save for  exceptional circumstances that again need to communicated to his coach and  manager.</li>
        <li>I am aware that there will be NO  REFUND for my son if he registers, then decides that he wants to withdraw from  his team.</li>
      </ul></td>
  </tr>
  <tr>
    <td width="40%">I have read and understand all the conditions that have been explained above</td>
    <td>{understandconditions}</td>
  </tr>
  <tr>
    <td width="40%">I give permission for my son to play basketball for Rosmini College in Semester 1 (Term 1 & 2)</td>
    <td>{permission}</td>
  </tr>
  <tr>
    <td width="40%"><p> </p>
      <p><strong>Payment Instructions</strong></p></td>
    <td> </td>
  </tr>
  <tr>
    <td width="40%">Do you intend to enrol for Skills Sessions in Term 1 at $45 for the term? (This cost is separate to Player Registration costs)</td>
    <td>{skillsessions}</td>
  </tr>
  <tr>
    <td width="40%">Player registration ($115 for Semester 1)</td>
    <td>{registration}</td>
  </tr>
  <tr>
    <td width="40%">Payment Method</td>
    <td>{paymentmethod}</td>
  </tr>
  <tr>
    <td colspan="2"><p>Payment instructions:</p>
      <ul>
        <li>Bank details: BNZ</li>
        <li>Please use: <strong>Childs  name ‘Registration’ & 78BBALL</strong> as the reference. <br>
          <em>i.e. J Smith – Registration – 78BBALL</em></li>
        <li>Payments must be made within five days of completing  this form.</li>
        <li>Cash/cheques (payable to Rosmini College) must only be  handed to Mr Samuels who will issue a receipt.</li>
        <li>PLEASE NOTE: NO MONEY CAN BE ACCEPTED AT THE TRIALS OR  SKILL SESSIONS FOR PLAYER REGISTRATION.</li>
        <li>Please contact <a href="mailto:basketball@school.nz">basketball@school.nz</a> with any further queries.</li>
      </ul>
      <p><strong>Please note: Registration and payments must be received by the … NO LATE REGISTRATIONS OR PAYMENTS CAN BE ACCEPTED.</strong></p>
      <p>In case of financial hardship, sponsorship may be available on request.  If you would like more information please tick the box.  Financial assistance is for players who otherwise would not be able to play basketball at all for Rosmini College and have no opportunity to play basketball elsewhere.  All correspondence will be strictly confidential.</p></td>
  </tr>
  <?php }
	if ( $_POST['finsupport'] == "1" ) {
 
  ?>
  <tr>
    <td colspan="2">Yes, please send information with respect to financial support.</td>
  </tr>
  <?php } ?>
</table>

GreyHead 21 Oct, 2014
Hi rcadmin,

What exactly is the problem? I don't see any obvious bugs in the code you posted.

I would comment out most of this, then uncomment a chunk at a time to pin down where the problem occurs.

Bob
rcadmin 21 Oct, 2014
Hi Bob,

Basically all the -mail returns is the IP address, nothing else. I have not commented out all the PHP but it still does the same thing.

If I take the PHP out totally, it works. Do you think it might be a CF5 bug in the custom template?
Gatsman 21 Oct, 2014
Remove the } after every <?php you got

- John
rcadmin 21 Oct, 2014
Hi, but I need those to keep the code (if statement) grouped. It has worked in the past.
Gatsman 21 Oct, 2014
I dont think a php statement will even work with this and you got it after every <?php opening
  <?php } // <-- you dont need this }
 if ( $_POST['playedbefore'] == "Yes" ) {
Gatsman 21 Oct, 2014
Try this code and tell me if it works and you got the results/template you want.

<table width="100%">
  <tr>
    <td width="40%" ><strong>Student Details</strong></td>
    <td> </td>
  </tr>
  <tr>
    <td width="40%">First name</td>
    <td>{studentname}</td>
  </tr>
  <tr>
    <td width="40%">Surname</td>
    <td>{studentsurname}</td>
  </tr>
  <tr>
    <td width="40%">Address</td>
    <td>{address}</td>
  </tr>
  <tr>
    <td width="40%">Suburb</td>
    <td>{suburb}</td>
  </tr>
  <tr>
    <td width="40%">Postal Code</td>
    <td>{postalcode}</td>
  </tr>
  <tr>
    <td width="40%">Date of Birth</td>
    <td>{dob}</td>
  </tr>
  <tr>
    <td width="40%">School year in 2015</td>
    <td>{schoolyear}</td>
  </tr>
  <tr>
    <td colspan="2"><p> </p>
      <p><strong>Playing Experience</strong></p></td>
  </tr>
  <tr>
    <td width="40%">Played last year?</td>
    <td>{playedbefore}</td>
  </tr>
  <tr>
    <td width="40%">Rate your experience</td>
    <td>{experiencelevel}</td>
  </tr>
  <?php if ( $_POST['playedbefore'] == "Yes" ) {?>
  <tr>
    <td colspan="2"><p>If you played last year then complete the following:</p></td>
  </tr>
  <tr>
    <td width="40%">Team</td>
    <td>{team}</td>
  </tr>
  <tr>
    <td width="40%">League</td>
    <td>{league}</td>
  </tr>
  <?php } ?>
  <tr>
    <td width="40%"><p> </p>
      <p><strong>Parent Details</strong></p></td>
    <td> </td>
  </tr>
  <tr>
    <td width="40%">Name</td>
    <td>{parentname}</td>
  </tr>
  <tr>
    <td width="40%">E-mail</td>
    <td>{parentemail}</td>
  </tr>
  <tr>
    <td width="40%">Phone</td>
    <td>{parenthomephone}</td>
  </tr>
  <tr>
    <td width="40%">Parent Mobile</td>
    <td>{parentmobile}</td>
  </tr>
  <tr>
    <td width="40%">Volunteering</td>
    <td> </td>
  </tr>
  <tr>
    <td colspan="2"><p>Rosmini College is grateful for volunteer support.  Without this we are unable to enter teams into the Harbour Intermediate league.</p></td>
  </tr>
  <tr>
    <td width="40%">I am available to assist in the following way(s):</td>
    <td>{volunteeroptions}</td>
  </tr>
  <?php if ( $_POST['volunteeroptions'] <> "" ) {?>
  <tr>
    <td colspan="2"><p>If volunteering for coaching, please fill in preferred training day and time.  Please note that this is not a confirmation of this training time.</p></td>
  </tr>
  <tr>
    <td width="40%">Day</td>
    <td>{vday}</td>
  </tr>
  <tr>
    <td width="40%">Session</td>
    <td>{session}</td>
  </tr>
  <tr>
    <td width="40%">Time</td>
    <td>{time}</td>
  </tr>
  <?php } ?>
  <tr>
    <td colspan="2"><ul>
        <li>Due  to lack of gym space we ask that coaches be prepared to gym share</li>
        <li>Morning  sessions must be finished by 830am, afternoon sessions must be finished by  430pm</li>
        <li>Options  are also available for trainings in the Old Gym during Junior Lunch time  (1200pm-1250pm)</li>
      </ul></td>
  </tr>
  <tr>
    <td width="40%"><p> </p>
      <p><strong>Conditions of play</strong></p></td>
    <td> </td>
  </tr>
  <tr>
    <td colspan="2"><ul>
        <li>I am aware my son must purchase a  pair of regulation Rosmini College playing shorts, available from the school  stationery shop to be worn for games at a cost of $45</li>
        <li>I am aware my son will be allocated  a playing singlet which is his responsibility to care for during the season.  THIS SINGLET IS NOT TO BE WORN FOR ANYTHING OTHER THAN BASKETBALL GAMES. I am  aware that any cost for replacement due to damage or loss will be charged to  me.</li>
        <li>I am aware my son will be expected  to attend ALL trainings organised by his team coach throughout the season, save  for exceptional circumstances which will be communicated to the coach and  manager of his team.</li>
        <li>I am aware that my son will be  expected to attend ALL games played on Mondays at the North Shore Event Centre  or AUT Gymnasium between 400pm – 830pm throughout the season, save for  exceptional circumstances that again need to communicated to his coach and  manager.</li>
        <li>I am aware that there will be NO  REFUND for my son if he registers, then decides that he wants to withdraw from  his team.</li>
      </ul></td>
  </tr>
  <tr>
    <td width="40%">I have read and understand all the conditions that have been explained above</td>
    <td>{understandconditions}</td>
  </tr>
  <tr>
    <td width="40%">I give permission for my son to play basketball for Rosmini College in Semester 1 (Term 1 & 2)</td>
    <td>{permission}</td>
  </tr>
  <tr>
    <td width="40%"><p> </p>
      <p><strong>Payment Instructions</strong></p></td>
    <td> </td>
  </tr>
  <tr>
    <td width="40%">Do you intend to enrol for Skills Sessions in Term 1 at $45 for the term? (This cost is separate to Player Registration costs)</td>
    <td>{skillsessions}</td>
  </tr>
  <tr>
    <td width="40%">Player registration ($115 for Semester 1)</td>
    <td>{registration}</td>
  </tr>
  <tr>
    <td width="40%">Payment Method</td>
    <td>{paymentmethod}</td>
  </tr>
  <tr>
    <td colspan="2"><p>Payment instructions:</p>
      <ul>
        <li>Bank details: BNZ</li>
        <li>Please use: <strong>Childs  name ‘Registration’ & 78BBALL</strong> as the reference. <br>
          <em>i.e. J Smith – Registration – 78BBALL</em></li>
        <li>Payments must be made within five days of completing  this form.</li>
        <li>Cash/cheques (payable to Rosmini College) must only be  handed to Mr Samuels who will issue a receipt.</li>
        <li>PLEASE NOTE: NO MONEY CAN BE ACCEPTED AT THE TRIALS OR  SKILL SESSIONS FOR PLAYER REGISTRATION.</li>
        <li>Please contact <a href="mailto:basketball @[at] school [dot] nz">basketball @[at] school [dot] nz</a> with any further queries.</li>
      </ul>
      <p><strong>Please note: Registration and payments must be received by the … NO LATE REGISTRATIONS OR PAYMENTS CAN BE ACCEPTED.</strong></p>
      <p>In case of financial hardship, sponsorship may be available on request.  If you would like more information please tick the box.  Financial assistance is for players who otherwise would not be able to play basketball at all for Rosmini College and have no opportunity to play basketball elsewhere.  All correspondence will be strictly confidential.</p></td>
  </tr>
  <?php if ( $_POST['finsupport'] == "1" ) {?>
  <tr>
    <td colspan="2">Yes, please send information with respect to financial support.</td>
  </tr>
  <?php } ?>
</table>
rcadmin 21 Oct, 2014
aaagh... didn't see that ... crazy how I kept missing it. 😲
This topic is locked and no more replies can be posted.