php select默认选中
<option <?php if($row_news_upd1['sex']==='男'){ echo 'selected';}?> value='男' >男</option>
php乱码
header("Content-Type: text/html;charset=utf-8");
php输出js
$msg = "<script>alert('成功');history.go(-2); </script>";
echo $msg;
php输出html
while($row = $result->fetch_assoc()) { echo "<a href={$row['link']} title=''> {$row['name']}</a></br>"; }
echo "<ul>";
while($row = $result->fetch_assoc()) {
echo "<li>"."<a href={$row['link']} title=''> {$row['name']}</a></br>"."</li>";
}
echo "</ul>";
mysql报错 Unknown column ‘name’ in ‘field list’
因为字段类型是varchar 插入的时候带''
php 输出class 名字
<?php
$res=1;
//可以是查询出来的mysql
?>
<html>
<style>
.on{
color: red;
}
</style>
<?php
$a=$res==1?on :'';
echo "<li class=$a>";
echo "真好 </li>"
?>
</html>