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 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)