Note that there are some explanatory texts on larger screens.

plurals
  1. PONeed to access <input> data from a <form>, that has been appended with Javascript
    primarykey
    data
    text
    <p>I have an admin page where I add and delete table rows on the fly. The page comes loaded with the existent data in the database (mostly consisting in a sku_code and 5 different prices) but when I add rows on the fly, and fill them with the corresponding skus and prices, I want to save them as well in the database.</p> <p>The problem is that what I do on the client-side with Javascript (add table rows on the fly) with <code>innerHTML = '&lt;input type="text"&gt;</code> is not accesible via <code>$_POST</code> variables of the main <code>&lt;form&gt;</code></p> <p>So basically i add via Javascript 's so i can fill them and save them as well in the database. But the $_POST values are empty. Javascript code works fine. I have no clue where should i start debugging.</p> <p>here's some Javascript code i'm using</p> <pre><code>function insert_record(){ var my_table = document.getElementById('my_table') var tr = my_table.insertRow(my_table.rows.length-1) //id-ul curent, numar toate row-urile - 1 (care este butonul OK) var c_id = my_table.rows.length-2 tr.id = 'row_' + c_id + '' var tr_td_1 = tr.insertCell(0) tr_td_1.className = 'text2' tr_td_1.align = 'center' tr_td_1.innerHTML = 'SKU' var tr_td_2 = tr.insertCell(1) tr_td_2.className = 'text3' tr_td_2.width = '63' tr_td_2.innerHTML = '&lt;input name="sku_' + c_id + '" type="text" id="sku_' + c_id + '" size="33" value=""&gt;' </code></pre> <p>....this addes a inside the table just before the last which contains the submit button, after which there's the </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