Hi I have made a HTML Form with check boxes and text boxes for submitting data to the database table

Problem is it does not capture the values in the text boxes array but captures the one on the check boxes but the values in the text boxes is blank on submitting the form
Have tried a 1000 times and can't figure out what is happening some with an idea help.

HTML FORM CODE foe text box and check box
echo"<td><input type='text' name='newvalue[]'> </td>
<td><input type='checkbox' name='checked[]' value=$id ></td>


PHP script for processing the submitted results

//entered values array
$nvalue = $_POST;

foreach ($nvalue as $key => $value){

//checked values array
$chkd = $_POST;

foreach ($chkd as $key => $value){


$sql="update invoice_subcategory set Item_Cost='$nvalue[$i]'
where ID='$chkd[$i]'";
echo $sql."<br>";
echo $chkd[$i];
echo $nvalue[$i];

Edited by happygeek: fixed formatting

10 Years
Discussion Span
Last Post by somedude3488

I can't see what you are wanting to accomplish with this code

foreach ($nvalue as $key => $value){

the following shows your array is just fine as it is

foreach ($nvalue as $key=>$value){
 echo $key."=".$value."<br>";

Why are you overwriting the array values?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.