Note that there are some explanatory texts on larger screens.

plurals
  1. POMoved data not sending in php submit
    text
    copied!<p>I'm using the following function to move data between two select fields:</p> <pre><code>&lt;script language="javascript"&gt; function move(tbFrom, tbTo) { var arrFrom = new Array(); var arrTo = new Array(); var arrLU = new Array(); var i; for (i = 0; i &lt; tbTo.options.length; i++) { arrLU[tbTo.options[i].text] = tbTo.options[i].value; arrTo[i] = tbTo.options[i].text; } var fLength = 0; var tLength = arrTo.length; for(i = 0; i &lt; tbFrom.options.length; i++) { arrLU[tbFrom.options[i].text] = tbFrom.options[i].value; if (tbFrom.options[i].selected &amp;&amp; tbFrom.options[i].value != "") { arrTo[tLength] = tbFrom.options[i].text; tLength++; } else { arrFrom[fLength] = tbFrom.options[i].text; fLength++; } } tbFrom.length = 0; tbTo.length = 0; var ii; for(ii = 0; ii &lt; arrFrom.length; ii++) { var no = new Option(); no.value = arrLU[arrFrom[ii]]; no.text = arrFrom[ii]; tbFrom[ii] = no; } for(ii = 0; ii &lt; arrTo.length; ii++) { var no = new Option(); no.value = arrLU[arrTo[ii]]; no.text = arrTo[ii]; tbTo[ii] = no; } } &lt;/script&gt; </code></pre> <p>main php page</p> <pre><code>&lt;?php mysql_select_db($database_UARData, $UARData); $query_DistributionGroups = "SELECT distgrp.distgrpnme FROM distgrp"; $DistributionGroups = mysql_query($query_DistributionGroups, $UARData) or die(mysql_error()); $row_DistributionGroups = mysql_fetch_assoc($DistributionGroups); $totalRows_DistributionGroups = mysql_num_rows($DistributionGroups); ?&gt; &lt;select name="newusrdgavail" size="10" id="newusrdgavail" style="width:300px"&gt; &lt;?php do { ?&gt; &lt;option value="&lt;?php echo $row_DistributionGroups['distgrpnme']?&gt;"&gt;&lt;?php echo $row_DistributionGroups['distgrpnme']?&gt;&lt;/option&gt; &lt;?php } while ($row_DistributionGroups = mysql_fetch_assoc($DistributionGroups)); $rows = mysql_num_rows($DistributionGroups); if($rows &gt; 0) { mysql_data_seek($DistributionGroups, 0); $row_DistributionGroups = mysql_fetch_assoc($DistributionGroups); } ?&gt; &lt;/select&gt; &lt;/label&gt;&lt;/td&gt; &lt;td align="center" bgcolor="#CCCCCC"&gt;&lt;p&gt; &lt;input type="button" name="newusrdgadd" id="newusrdgadd" value="Add" onclick="move(newusrdgavail,newusrdgreq)"/&gt; &lt;/p&gt; &lt;p&gt; &lt;input type="button" name="newusrdgremove" id="newusrdgremove" value="Remove" onclick="move(newusrdgreq,newusrdgavail)"/&gt; &lt;/p&gt;&lt;/td&gt; &lt;td bgcolor="#CCCCCC"&gt;&lt;label&gt; &lt;select name="newusrdgreq" size="10" multiple="multiple" id="newusrdgreq" style="width:300px"&gt; &lt;/select&gt; &lt;/label&gt;&lt;/td&gt; </code></pre> <p>The move function works well and the moved values show in the correct field on the form. The problem is when I go to php submit:</p> <pre><code>$newusrdgreq = $_POST['newusrdgreq']; $email_message .= "Required Email Distribution Groups: ".$newusrdgreq."\n"; </code></pre> <p>I get the Notice: Undefined Index. On this field only. Everything else submits just fine. I know I can use the isset function to avoid empty or null values. However I think the great issue is that the "newusrdgreq" field is not getting the added and removed values properly attached to the field, but I cannot see why. Any help would be appreciated.</p>
 

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