I am not getting the proper representation of an HTML table after inserting php code in
“td” tag while the code is is php page only so that server can execute the code inside the “td” tag. Following is the code :
<table border=1>
<tr>
<td><select name="designer_response" id="designer_response" <?php if($variable == 0)echo 'disabled=disabled' ?> ><option value="Yes">Yes</option><option value="No">No</option></select></td>
<td><textarea name="designer_comments" id="designer_comments"><?php echo "".$designer_c ?></textarea></td>
<td><select name="reviewer_response" id="reviewer_response"><option value="Yes">Yes</option value="No"><option>No</option></select></td>
<td><textarea name="reviewer_comments" id="reviewer_comments"><?php echo "".$reviewer_c ?></textarea></td>
</tr>
</table>
Thanks…
Please find the php code that modifies and defines the variables in the code snppet given above :
<?php
$id = 'Q420';
$phase_of_review = 0;
$designereviewer_r = "";
$designereviewer_c = "";
$reviewer_r = "";
$reviewer_c = "";
$con = mysql_connect("localhost","root","");
mysql_select_db("checklist", $con);
//Extracting data...
$s = "select * from dummy";
$resource = mysql_query($s , $con);
if($resource == TRUE)
{
//Yes data is there , fetch it ..
$data = mysql_fetch_assoc($resource);
$designer_r = $data['designer_response'];
$designer_c = $data['designer_comments'];
$reviewer_r = $data['reviewer_response'];
$reviewer_c = $data['reviewer_comments'];
echo "designer_response".$designer_r;
}
else
$phase_of_review = 1;
$variable = 1;
?>
Below is the output html of the php code given above:
<table border=1 bordercolor="black">
<tr>
<td><select name="designer_response" id="designer_response" ><optionvalue="Yes">Yes</option><option value="No">No</option></select></td>
<td><textarea name="designer_comments" id="designer_comments">ok2</textarea></td>
<td><select name="reviewer_response" id="reviewer_response"><option value="Yes">Yes</option value="No"><option>No</option></select></td>
<td><textarea name="reviewer_comments" id="reviewer_comments">ok3</textarea></td>
</tr>
</table>
Two things stand out to me in the output HTML, but I’m not sure they will actually solve your problems. First, there is a space missing with the first “Yes” option tag in the output HTML, but this could be just a copy/paste issue. In the output HTML, the first option tag is appearing as
optionvalue, which is invalid.Second, you have the
value="No"attribute in yourreviewer_responseselect list in the closingoptiontag for the “Yes” option rather than in the opening tag of the “No” option.To me, neither of those really says, “this is what’s causing the primary issue;” however, cleaning up the little issues with the code could solve the bigger problems as a side effect.