dongshen7407 2012-01-09 11:16
浏览 80
已采纳

在<td>标记内插入php代码后,HTML表格的可视化表示形式发生了变化

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>
  • 写回答

1条回答 默认 最新

  • douhuan6305 2012-01-09 17:28
    关注

    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 your reviewer_response select list in the closing option tag 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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 在获取boss直聘的聊天的时候只能获取到前40条聊天数据
  • ¥20 关于URL获取的参数,无法执行二选一查询
  • ¥15 液位控制,当液位超过高限时常开触点59闭合,直到液位低于低限时,断开
  • ¥15 marlin编译错误,如何解决?
  • ¥15 有偿四位数,节约算法和扫描算法
  • ¥15 VUE项目怎么运行,系统打不开
  • ¥50 pointpillars等目标检测算法怎么融合注意力机制
  • ¥20 Vs code Mac系统 PHP Debug调试环境配置
  • ¥60 大一项目课,微信小程序
  • ¥15 求视频摘要youtube和ovp数据集