Forums

Custom HTML PHP not included in email

dblues 24 Apr, 2013
I am not sure where I am supposed to put this in the forums. So I am sorry if i put this in the wrong place.
I am building a form for a Parts request so I followed the add one code found on your website for adding additional part number fields. http://www.chronoengine.com/faqs/2700-how-can-i-have-a-button-to-add-more-form-inputs.html
I didn't edit the code yet except for adding another field and changing the labels. Just wanting to test it out before modifying it too much.

<?php
// set the total count
$count = 5;
for ( $i = 1; $i <= $count; $i++ ) {
  // add classes which will let us identify the inputs to hide
  if ( $i == 1 ) {
    $class = 'show_me';
  } else {
    $class = 'hide_me';
  }
  // add the 'Add one' buttons (but not to the last set)
  if ( $i < $count ) {
    $j = $i+1;
    $button = "<div><input type='button' name='addone_{$j}' id='addone_{$j}' value='Add one' class='add_one' /></div>";
  } else {
    $button = "";
  }
  // add the inputs with a little ChronoForms styling
  echo "<div id='recipient_{$i}' class='{$class}' >
  <div class='multiline_start'>
    <label>Part Number</label>
    <input type='text' name='[recipient{$i}][partnumber]' id='recipient_{$i}_name' />
  </div>
  <div class='multiline_add'>
    <label>Part Description</label>
    <input type='text' name='[recipient{$i}][description]' id='recipient_{$i}_address' />
  </div>
 <div class='multiline_add'>
    <label>Quantity</label>
    <input type='text' name='recipient[{$i}][quantity]' id='recipient_{$i}_address' />
  </div>
  <div class='clear' ></div>
  {$button}
</div>";
}
?>



I'm not the best with coding php forms i can do basic stuff but thats why I use Chronoforms lol

So What i would like to accomplish with this form is to allow the website user to enter the part number, part description and quantity of the part. and then be able to add as many parts needed by clicking the "add one/more" button.
Then this custom field would submit a list of the info entered in the email form.

I have the "add one/more" working on the front end but the field doesn't show up in the email that is sent to me. Is it maybe something I need to check off or add to my email code?


Any help would be greatly appreciated! Thank you for your time!
dblues 02 May, 2013
Any thoughts????
GreyHead 15 May, 2013
Hi dblues,

Your email template can't know about multiple repeating input values unless you tell it. I'd probably write a little PHP in a Custom Code action to loop through the results and output a block of formatted HTML that can be included in the template.

Bob
This topic is locked and no more replies can be posted.