Note that there are some explanatory texts on larger screens.

plurals
  1. POemailing dynamically created fields PHP + JQuery
    primarykey
    data
    text
    <p>I can't find an exact answer to this and I am not a developer myself so its probably something simple which I am doing wrong.</p> <p>I have created a form which can dynamically add a group of fields using jquery and cloning a tag as follows:</p> <pre><code>&lt;div class="container"&gt;&lt;li id="li_6" &gt; &lt;label class="description" for="element_6"&gt;Advert Title (Up to 35 characters including spaces) &lt;/label&gt; &lt;input id="element_6" name="element_6[]" class="element text medium" type="text" maxlength="255" value=""/&gt; &lt;/li&gt; &lt;li id="li_7" &gt; &lt;label class="description" for="element_7"&gt;Advert Body Text (Up to 70 characters including spaces) &lt;/label&gt; &lt;textarea id="element_7[]" name="element_7" class="element textarea small"&gt;&lt;/textarea&gt; &lt;/li&gt; &lt;li id="li_8" &gt; &lt;label class="description" for="element_8"&gt;Advert Keywords (These are the words or phrases your potential customers will search for. Only 1 per line) &lt;/label&gt; &lt;textarea id="element_8[]" name="element_8" class="element textarea medium"&gt;&lt;/textarea&gt; </code></pre> <p></p> <pre><code> &lt;a href="#" id="add"&gt; Click to Add Another Advert&lt;/a&gt; &lt;a href="#" id="remove"&gt;| Remove Last Advert&lt;/a&gt; &lt;/li&gt; </code></pre> <p>All of this works fine, the only problem is that when email function is run, I only get the latest added group of fields and not all of them on the received email:</p> <pre><code>if($act=="post"){ $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: 123Click&lt;support@123click.co.za&gt;' . "\r\n"; $to = 'support@123click.co.za'; $subject ='New Adwords Setup'; $message = "&lt;b&gt;&lt;u&gt;Section A: Login&lt;/u&gt;&lt;/b&gt;&amp;nbsp;".'&lt;br&gt;'; $message = "&lt;b&gt;Login Email:&lt;/b&gt;&amp;nbsp;".$_POST["element_1"].'&lt;br&gt;'; $message = "&lt;b&gt;&lt;u&gt;Section B: Settings&lt;/u&gt;&lt;/b&gt;&amp;nbsp;".'&lt;br&gt;'; $message .= "&lt;b&gt;Location:&lt;/b&gt;&amp;nbsp;".$_POST["element_9"].'&lt;br&gt;'; $message .= "&lt;b&gt;Daily Budget:&lt;/b&gt;&amp;nbsp;".$_POST["element_10"].'&lt;br&gt;'; $message .= "&lt;b&gt;Web Address:&lt;/b&gt;&amp;nbsp;".$_POST["element_4"].'&lt;br&gt;'; $message = "&lt;b&gt;&lt;u&gt;Section C: Adverts&lt;/u&gt;&lt;/b&gt;&amp;nbsp;".'&lt;br&gt;'; $message .= "&lt;b&gt;Advert Title:&lt;/b&gt;&amp;nbsp;".$_POST["element_6"].'&lt;br&gt;'; $message .= "&lt;b&gt;Advert Body:&lt;/b&gt;&amp;nbsp;".$_POST["element_7"].'&lt;br&gt;'; $message .= "&lt;b&gt;Advert Keywords:&lt;/b&gt;&amp;nbsp;".$_POST["element_8"].'&lt;br&gt;'; mail($to, $subject, $message, $headers); </code></pre> <p>What am I doing wrong, and please explain as simply as possible. Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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.
 

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