1
代碼爲「php」代碼時,我沒有在代碼中插入php代碼時獲得HTML表格的正確表示,因此服務器可以執行「td」標籤內的代碼。以下是代碼:在插入php代碼後,HTML表格變得可視化代表代碼
<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>
謝謝...
請找到PHP代碼,修改並定義上面給出的代碼snppet變量:
<?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;
?>
下面是輸出HTML上面給出的php代碼:
<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>
你得到了什麼?它與你期望的有什麼不同? – Quentin 2012-01-09 11:18:06
請發佈PHP代碼,包括設置變量調用的部分,並描述您在演示文稿中認爲是錯誤的部分。也運行HTML驗證,因爲您的代碼現在有語法錯誤。 – 2012-01-09 11:27:32
@ Jukka K. Korpela嗨Jukka,添加了代碼.. – cbinder 2012-01-09 15:15:48