Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You need to put quotes around the value in the hidden input. Otherwise, the attribute ends at the space after <code>Fri</code>.</p> <pre><code>newTextBoxDiv.after().html('&lt;div&gt;&lt;label style="float:left;"&gt;'+yo+'&lt;/label&gt;&lt;/div&gt;&lt;textarea name="textbox' + counter + '" id="textbox' + counter + '" &gt;&lt;/textarea&gt;&lt;input type="hidden" name="time" value="'+yo+'"/&gt;'); </code></pre> <p>However, this probably won't work, either. I don't think MySQL understands dates in the format you're entering them. It wants them in the format <code>2013-12-27</code>, not <code>Fri Dec 27 2013</code>. You need to convert the dates to this format, either in Javascript or in the server program, or in your SQL with the <code>STR_TO_DATE</code> function.</p> <p>The reason you're getting the wrong time is because your form has multiple <code>&lt;input type="hidden" name="time" value="XXX"/&gt;</code> elements. When you submit the form, only the first one gets used.</p> <p>Instead of appending a new <code>time</code> input each time, you should update the existing one. Add <code>id="time"</code> to the original hidden input, and then do:</p> <pre><code>$("#time").value(yo); </code></pre> <p>in your <code>setInterval</code> function. It should be:</p> <pre><code>setInterval(function() { var xtime=null; if(yo.getTime() &lt;= d.getTime() &amp;&amp; yo.getTime() &lt;= d5.getTime()){ if( (d1.getTime() == d3.getTime()) || (d1.getTime() == d4.getTime())){ var freq=$('#freq').val(); freq=parseInt(freq); var newTextBoxDiv = $("&lt;div&gt;", { "id": 'TextBoxDiv' + counter }); newTextBoxDiv.after().html('&lt;div&gt;&lt;label style="float:left;"&gt;'+yo+'&lt;/label&gt;&lt;/div&gt;&lt;textarea name="textbox' + counter + '" id="textbox' + counter + '" &gt;&lt;/textarea&gt;'); newTextBoxDiv.appendTo("#TextBoxesGroup"); $("#time").val(yo); yo.setMinutes(yo.getMinutes() + freq); } counter++; } },1000); </code></pre>
 

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