Note that there are some explanatory texts on larger screens.

plurals
  1. POhtml form and php post not working, information is being rewritten
    primarykey
    data
    text
    <p>I have the following code that generates my form on my html page</p> <pre><code>&lt;input type="hidden" name="name[&lt;? echo $productid; ?&gt;]" value="&lt;? echo $rows["id"];?&gt;"&gt; &lt;select name="name&lt;? echo $rows["id"]; ?&gt;" &gt; &lt;? for($i = 0; $i &lt;= sizeof($_SESSION['people']['name']); $i++){ echo "&lt;option&gt;"; echo $_SESSION['people']['name'][$i]; echo "&lt;/option&gt;"; } echo "&lt;/select&gt;"; ?&gt; </code></pre> <p>then, this form is submited to a page that is currently holding </p> <pre><code>var_dump($_POST); </code></pre> <p>and its printing out the following</p> <pre><code>array(3) { ["name"]=&gt; array(2) { [2]=&gt; string(1) "2" [6]=&gt; string(1) "6" } ["name2"]=&gt; string(12) "first person" ["name6"]=&gt; string(15) "andother person" } </code></pre> <p>However, as you can see, both names are being posted properly, however they are not properly associated.</p> <p>string(1) is pointing to both 6 and 2. these are my product numbers and they need to be paired with a name.</p> <p>can you please let me know how i can cleanup my form and properly with a a foreach loop, extract each attribute. ie the name, and the id number ( 6, 2 ...) </p> <p>basically, i wanna know which name is being associated with which product id number => 2, 6, etc... i want the name to be save as $name and the id as $id. then insert to table (name, id) values ( $name, $id)... however, it should be in a loop to grab all of the $names and $ids. so the first run through, it should grab "first Person and group it with 2" 2nd run through, it should grab "another person and group it with 6"</p> <p>Sorry, english is not my first language. Please excuse any poor grammer. </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