dongshen7407 2012-01-09 11:16 采纳率: 0%
浏览 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 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 R语言卸载之后无法重装,显示电脑存在下载某些较大二进制文件行为,怎么办
  • ¥15 java 的protected权限 ,问题在注释里