Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To allow multiple checkbox values, you must add <code>[]</code> to the name attribute. PHP will then treat it as an array:</p> <pre><code>&lt;input type=checkbox name="valid_license[]" id="valid_license" ... /&gt; </code></pre> <p>Then be sure to process them as an array. Your <code>$this-&gt;valid_license</code> becomes an array as well.</p> <pre><code>// Something like foreach ($_POST['valid_license'] as $license) { // Append each sanitized element onto valid_license[] $this-&gt;valid_license[] = $this-&gt;Sanitize($license); } </code></pre> <p>Note, that you must supply different <code>id=</code> attributes to each one. The HTML spec requires than id attributes be unique. Right now, all of yours have <code>id='valid_license'</code>. Change them to <code>id='valid_license1'</code> or similar.</p> <h3>Update (modifying function)</h3> <pre><code>function ComposeFormtoEmail() { $header = $this-&gt;GetHTMLHeaderPart(); $formsubmission = $this-&gt;FormSubmissionToMail(); $extra_info = $this-&gt;ExtraInfoToMail(); $footer = $this-&gt;GetHTMLFooterPart(); // Assign this to a variable $licenses = implode(", ", $this-&gt;valid_license); // Then insert that variable into `$message` $message = $header."Job Application Submission From thermosealinsulation.ca :&lt;p&gt;$licenses&lt;/p&gt;&lt;p&gt;$formsubmission&lt;/p&gt;&lt;hr/&gt;$extra_info".$footer; //---------------------------------------------------------------------------^^^^^^^^^^^^^^^^ return $message; } </code></pre> <h3>Update 2 The FormSubmissionToMail() function</h3> <p>Ok, I think I finally get it. The fields and their headings are produced by <code>FormSubmissionToMail()</code>. So that's where you need to add the <code>implode()</code> call, rather than in the <code>ComposeFormToEmail()</code> function as we did earlier:</p> <pre><code>function FormSubmissionToMail() { $ret_str=''; foreach($_POST as $key=&gt;$value) { if(!$this-&gt;IsInternalVariable($key)) { // MOVED THIS BLOCK FROM BELOW... // CHANGES BEGIN HERE..... // This loop looks over all the $_POST values. Need to isolate the `valid_licenses` and do something special with it. if ($key == "valid_license") { $value = implode(", ", $value); // Now $value will output as the comma-separated values list. } // CHANGES END HERE $value = htmlentities($value,ENT_QUOTES,"UTF-8"); $value = nl2br($value); $key = ucfirst($key); $ret_str .= "&lt;div class='label'&gt;$key :&lt;/div&gt;&lt;div class='value'&gt;$value &lt;/div&gt;\n"; } } foreach($this-&gt;fileupload_fields as $upload_field) { $field_name = $upload_field["name"]; if(!$this-&gt;IsFileUploaded($field_name)) { continue; } $filename = basename($_FILES[$field_name]['name']); $ret_str .= "&lt;div class='label'&gt;File upload '$field_name' :&lt;/div&gt;&lt;div class='value'&gt;$filename &lt;/div&gt;\n"; } return $ret_str; } ### Now that this is the correct location, go back and remove the changes we made to `ComposeFormToEmail()` </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload