Php 我的单选按钮在网页上不可见
我正在使用“PHP和SQL for dummies第四版”一书学习web编程。我的PetCatalog接口用于检索和显示数据库中的所有PetType。它正在检索数据库中的宠物,但没有单选按钮。我不知道错误是从哪里来的,因为代码中的一切似乎都已就绪。 注意:除单选按钮符号未显示外,所有功能均正常工作。PS:这个程序需要一个虚构的数据库,以使任何试图提供帮助的人都有意义,因为数据库在我的系统中。谢谢Php 我的单选按钮在网页上不可见,php,mysql,Php,Mysql,我正在使用“PHP和SQL for dummies第四版”一书学习web编程。我的PetCatalog接口用于检索和显示数据库中的所有PetType。它正在检索数据库中的宠物,但没有单选按钮。我不知道错误是从哪里来的,因为代码中的一切似乎都已就绪。 注意:除单选按钮符号未显示外,所有功能均正常工作。PS:这个程序需要一个虚构的数据库,以使任何试图提供帮助的人都有意义,因为数据库在我的系统中。谢谢 <?php /* Program: PetCatalog.php * Desc: Displa
<?php
/* Program: PetCatalog.php
* Desc: Displays a list of pet categories from the
* PetType table. Includes descriptions.
* Displays radio buttons for user to check.
*/
?>
<html>
<head><title>Pet Types</title></head>
<body>
<?php
$user="root";
$host="localhost";
$password="";
$database="PetCatalog";
$cxn = mysqli_connect($host,$user,$password,$database)
or die ("couldn't connect to server");
/* Select all categories from PetType table */
$query = "SELECT * FROM PetType ORDER BY petType";
$result = mysqli_query($cxn,$query)
or die ("Couldn't execute query.");
/* Display text before form */
echo "<div style='margin-left: .1in'>\n
<h1 style='text-align: center'>Pet Catalog</h1>\n
<h2 style='text-align: center'>The following animal
friends are waiting for you.</h2>\n
<p style='text-align: center'>Find just what you want
and hurry in to the store to pick up your
new friend.</p>
<h3>Which pet are you interested in?</h3>\n";
/* Create form containing selection list */
echo "<form action='ShowPets.php' method='POST'>\n";
echo "<table cellpadding='5' border='1'>";
$counter=1;
while($row = mysqli_fetch_assoc($result))
{
extract($row);
echo "<tr><td valign='top' width='15%'
style='font-weight: bold;
font-size:1.2em'\n";
echo "<input type='radio' name='interest' value='$petType'\n";
if( $counter == 1 )
{
echo "checked='checked'";
}
echo ">$petType</td>";
echo "<td>$typeDescription</td></tr>";
$counter++;
}
echo "</table>";
echo "<p><input type='submit' value='Select Pet Type'>
</form></p>\n";
?>
</div>
</body>
</html>
宠物类型
我首先想到的是,你的台词
echo "<tr><td valign='top' width='15%'
style='font-weight: bold;
font-size:1.2em'\n";
echo”就像刚才说的关闭表数据和表行
我已经测试了您的,但没有关闭表数据和表行
关闭表数据和表行后
这本书应该包含一个关于检查错误的部分。“查看来源“在浏览器中查找损坏的标记。Firefox有时会突出显示它。您还可以通过W3C之类的标记验证器来运行它,尽管这可能会突出显示许多不一定相关的问题。您在Second中比我快,现在运行得很好。上帝保佑你,兄弟。多谢各位。你不知道我有多感激……我让benn和它斗争了好几天,现在正试图找到bug。没问题!很高兴我能帮忙!介意把我的答案标记为正确答案吗?没问题@Ulabcie!谢谢你给我的第一个正确答案!(我不习惯在这里回答问题。)谢谢。我真的很感激。
echo "<tr><td valign='top' width='15%'
style='font-weight: bold;
font-size:1.2em'>\n";