Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy would an html text input name cause a submit input not to set?
    primarykey
    data
    text
    <p>I have an <code>html</code> form, with 13 <code>&lt;input&gt;</code> fields and approx. 92 different rows, created using <code>php</code> which pulls the records from a <code>mySQL</code> database. For some reason when I have a name assigned to this one field, it causes my <code>&lt;input type="submit" name="update_submit"&gt;</code> button not to set. If I change the name, it doesn't matter, but if I remove the name it will allow the other fields to update just fine.</p> <p>Here is a snippet of my form code( <code>$i</code> is auto incremented):</p> <p>Up Top...</p> <pre><code>&lt;form method="post" action="process_form.php"&gt; &lt;table&gt; &lt;tr&gt; </code></pre> <p>Further down...</p> <pre><code>echo "&lt;td align=\"center\" class=\"edit_emp_comp_exp_cell\"&gt;&lt;input type=\"text\" maxlength=\"10\" size=\"10\" id=\"Lic_Comp_Exp$i\" name=\"Lic_Comp_Exp[]\" value=\"" . $emp_query['Lic_Comp_Exp'] . "\"&gt;"; &lt;input type="submit" name="update_submit" style="width:100px;" value="UPDATE"&gt; </code></pre> <p>Further down...</p> <pre><code>&lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; </code></pre> <p>Here is my process_form:</p> <pre><code>if(isset($_POST['update_submit'])) { $id = $_POST['Emp_ID']; $name = $_POST['Emp_Name']; $phone = $_POST['Emp_Phone']; $start = $_POST['Start_Date']; $leave = $_POST['Paid_Leave']; $aca = $_POST['Emp_ACA']; $licauth = $_POST['Lic_Auth_ID']; $authexp = $_POST['Lic_Auth_Exp']; $liccomp = $_POST['Lic_Comp_ID']; $compexp = $_POST['Lic_Comp_Exp']; $miscp = $_POST['MiscP_ID']; $position = $_POST['Pos_ID']; $active = $_POST['activeBox']; $i = 0; foreach($id as $update) { if (!isset($active[$i])) { $active[$i] = 0; } $sql = ("UPDATE employee SET Emp_Name = '$name[$i]', Emp_Phone = '$phone[$i]', Emp_Start_Date = '$start[$i]', Paid_Leave = '$leave[$i]', Emp_ACA = '$aca[$i]', Lic_Auth_ID = '$licauth[$i]', Lic_Auth_Exp = '$authexp[$i]', Lic_Comp_ID = '$liccomp[$i]', Lic_Comp_Exp = '$compexp[$i]', MiscP_ID = '$miscp[$i]', Pos_ID = '$position[$i]', Emp_Active = '$active[$i]' WHERE Emp_ID = '$update'"); echo "SQL: " . $sql . "&lt;br&gt;"; if(!$result_employee_update = $mysqli-&gt;query($sql)) { $errors[] = "There was an error updating the employee table. MySqli Error Number: " . $mysqli-&gt;errno . ""; goto end; } $i++; } goto redirect; } </code></pre> <p>I am at a total loss and have been troubleshooting this all morning, I would really appreciate some help.</p> <p><strong>UPDATE:</strong> When I change <code>if(isset($_POST['update_submit']))</code> to <code>if(!isset($_POST['update_submit']))</code> and run it, I get an error: </p> <pre><code>"Notice: Undefined offset: 83 ... on line 31" </code></pre> <p>and line 31 is my </p> <pre><code>`$sql = ("UPDATE employee SET Emp_Name = '$name[$i]', Emp_Phone = '$phone[$i]', Emp_Start_Date = '$start[$i]', Paid_Leave = '$leave[$i]', Emp_ACA = '$aca[$i]', Lic_Auth_ID = '$licauth[$i]', Lic_Auth_Exp = '$authexp[$i]', Lic_Comp_ID = '$liccomp[$i]', Lic_Comp_Exp = '$compexp[$i]', MiscP_ID = '$miscp[$i]', Pos_ID = '$position[$i]', Emp_Active = '$active[$i]' WHERE Emp_ID = '$update'");` </code></pre> <p>I think that means that one of my <code>&lt;input&gt;</code> is not an <code>array</code>, right? If that is so, I don't know how that can be, the <code>table</code> is there and its created dynamically from the <code>database</code>.</p> <p><strong>UPDATE2:</strong> I think I've got something figured out, but I don't know how to fix it. I tried leaving the <code>name="Lic_Auth_Exp"</code> and <code>name="Lic_Comp_Exp"</code> and then removing two different <code>name</code> attributes from other <code>input</code> fields. After doing that it seemed to run the code. So the problem isn't because of these specific fields, but it seems to be because of there being more than 11 <code>$_POST</code> values being passed. I looked through the <code>php.ini</code> file to see if there were any limits on such a thing, but I didn't see anything. Does anyone know what could be causing this??</p>
    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. 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