I am having an issue that I can not seem to resolve, I have a page that queries a database, from this query it lists information so that a report can be input into the database. The problem I am having is that with the current code it is not submitting the “report” section due to a conflict of html naming attribute. here is the current code
<?php
<?php
mysql_connect("*","*","*") or die(mysql_error());
mysql_select_db("*") or die(mysql_error());
$sql = "Select form_id,Location, dateofexam, Pfirstname, Plastname, dob, examtype, views, history, notes, orderingphysician, contactphone, statread, priors, stattranscribe, dtrcompleted, rcompletedby From formdata WHERE rcompleted ='y' and tcompleted =''";
$result = MYSQL_QUERY($sql);
while ($row=mysql_fetch_array($result))
if ($row[statread] == 'yes'){echo "<tr>
<td class='c22' bgcolor='red'><center><input type='checkbox' name='tcompleted[]' value='$row[form_id]'></center></td>
<td class='c1' bgcolor='red'>$row[form_id]</td>
<td class='c2' bgcolor='red'>$row[Location]</td>
<td class='c3' bgcolor='red'>$row[dateofexam]</td>
<td class='c4' bgcolor='red'>$row[Plastname]</td>
<td class='c5' bgcolor='red'>$row[Pfirstname]</td>
<td class='c6 ' bgcolor='red'>$row[dob]</td>
<td class='c7' bgcolor='red'>$row[examtype]</td>
<td class='c8' bgcolor='red'>$row[views]</td>
<td class='c9' bgcolor='red'>$row[history]</td>
<td class='c10' bgcolor='red'>$row[notes]</td>
<td class='c11' bgcolor='red'>$row[orderingphysician]</td>
<td class='c12' bgcolor='red'>$row[contactphone]</td>
<td class='c13' bgcolor='red'>$row[rcompletedby]</td>
<td class='c14' bgcolor='red'>$row[priors]</td>
<td class='c15' bgcolor='red'>$row[dtrcompleted]</td>
<td class='c16' bgcolor='red'><textarea id='report' name='report' cols='40' rows='1' tabindex='1'></textarea></td>
<td class='c23' bgcolor='red'><center><select name='rcompleted' tabindex='7'>
<option value='' selected='yes'></option>
</select></center>
</td>
</tr>";}
?>
After you Submit this “form” it is supposed to update four things, and here is the script for that
<?php
session_start();
if (!(isset($_SESSION['role']) && $_SESSION['role'] != '')) {
header ("Location: main_login.php");
}
if($_SESSION['role'] !== 'Transcriptionist') {
header ("Location: access.php");
}
mysql_connect("*","*","*") or die(mysql_error());
mysql_select_db("*") or die(mysql_error());
$com = @implode(',', array_map('intval', $_POST['tcompleted']));
$user=$_SESSION["myusername"];
$rcompleted=mysql_escape_string($_POST['rcompleted']);
$report=mysql_escape_string($_POST['report']);
// update all the checked exams
$sqlc = "UPDATE formdata SET tcompleted='y' where form_id IN ($com)";
$sqlct = "UPDATE formdata SET tcompletedby='$user' where form_id IN ($com)";
$sqlrc = "UPDATE formdata SET rcompletedby='$rcompleted' where form_id IN ($com)";
$sqlrep= "UPDATE formdata SET report='$report' where form_id IN ($com)";
mysql_query($sqlc);
mysql_query($sqlct);
mysql_query($sqlrep);
mysql_query($sqlrc);
?>
So again my issue is that because the name attribute for “report” is the same for every SQL row it causes conflict with the $_POST data.
I had a thought to add this code to the query page
<td class='c16' bgcolor='red'><textarea id='report' name='$row[form_id]report' cols='40' rows='1' tabindex='1'></textarea></td>
But the problem I couldnt figure out is how to have the mysql query update using that Variable POST name