Hi
I am struggling with entering data using php.
I have a query that pulls two rows of data from the database and displays the data in a table.
it creates the following html:
<form action="index.php" method="post">
<tr>
<td>789<input type="hidden" name="number[]" value="789" /></td>
<td>Telephone</td>
<td><textarea name="help[]" cols="30" rows="4"></textarea></td>
</tr>
<tr>
<td>790<input type="hidden" name="number[]" value="790" /></td>
<td>Computer</td>
<td><textarea name="help[]" cols="30" rows="4"></textarea></td>
</tr>
<tr>
<td><input type="submit" name="submit" value="Add" /><input type="hidden" name="submitted" value="true" /></td
<td> </td>
I want to be able to add both the help fields into the database with the respective number ie 789.
This is where i am lost, because we have got two arrays posted number[] and help[] and if i loop through one i cant get the corresponding value.
if(isset($_post['submitted'])) {
foreach($number as $n) {
$query = "insert $help into item where number = $n";
}
?>
I am struggling with entering data using php.
I have a query that pulls two rows of data from the database and displays the data in a table.
it creates the following html:
<form action="index.php" method="post">
<tr>
<td>789<input type="hidden" name="number[]" value="789" /></td>
<td>Telephone</td>
<td><textarea name="help[]" cols="30" rows="4"></textarea></td>
</tr>
<tr>
<td>790<input type="hidden" name="number[]" value="790" /></td>
<td>Computer</td>
<td><textarea name="help[]" cols="30" rows="4"></textarea></td>
</tr>
<tr>
<td><input type="submit" name="submit" value="Add" /><input type="hidden" name="submitted" value="true" /></td
<td> </td>
I want to be able to add both the help fields into the database with the respective number ie 789.
This is where i am lost, because we have got two arrays posted number[] and help[] and if i loop through one i cant get the corresponding value.
if(isset($_post['submitted'])) {
foreach($number as $n) {
$query = "insert $help into item where number = $n";
}
?>