Hi all,
I have a checkbox...
<input type="checkbox" name="attended['.$row2['ffnumber'].']" id="attended" class="results1" value="'.$row2['class_ID'].'" />
and a textfield...
<input type="text" name="note['.$value.']" id="note" value="" />
The textfield is assigned the below...
$value = $row2['ffnumber'].'-'.$row2['class_ID'];
When the form is submitted I set variables...
// Declare Variables
$attended = $_POST['attended'];
$note = trim($_POST['note']);
Then if checkboxes are selected I do this...
// IF CHECKBOX SELECTED
foreach($attended as $k => $v)
{
$query = "UPDATE training ".
"SET attended = 'Yes' ".
"WHERE ffnumber = '$k' ".
"AND class_ID = '$v'";
$result = mssql_query($query) or die('Update Query Error');
}
That works fine.
However, the below doesnt work at all. Nothing is printed...
// IF NOTE ENTERED
foreach($note as $x => $y)
{
echo '<p>'.$x. '=> '.$y.'</p>';
list($ffnumber, $class_ID) = split('[/.-]', $y);
$query = "UPDATE training ".
"SET note = '$y' ".
"WHERE ffnumber = '$x' ".
"AND class_ID = '$class_ID'";
echo '<p>'.$query.'</p>';
}
I want to set note to the value entered in the textfield($note)
The note textfield is populated with $value so I can use $ffnumber and $class_ID in the WHERE clause.
Any ideas how I can use all these variables??
Thanks