简体   繁体   中英

Saving Div's Array content to a MySQL database

I have table with input arrays and 1 div array. Of course i have no problem saving the input arrays to the database but when i do the same procedure for a div, its not working. When i view the column in the database, its blank.

<td><div name="partamount[]" id="partamount[]" class="amount" ></div> </td>

when you inspect the element:

屏幕截图

PHP

$partamount = $_POST['partamount'];
$partamountarray = implode( ", ", $partamount);



$result = mysqli_query($mysqli, "INSERT INTO invoices(partamount, login_id) VALUES('$partamountarray', '$loginId')");

<div> elements are not form elements so they don't get passed. You should rather use some <input> element or use javascript to populate an <input type="hidden"> field with the same data as your <div> element have.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM