PHP获取radio值,并用作参数查询数据库,同一页面显示
/***************************by garcon1986************************************/
<?php
error_reporting(E_ALL ^ E_NOTICE);
//create database test
//create table php_radio(id int(10) NOT NULL AUTO_INCREMENT, name varchar(100), description varchar(1000), primary key(id));
//insert php_radio values(1, 'eat','you have eaten ...');
//insert php_radio values(2, 'drink', 'you have drank ...');
//insert php_radio values(3, 'sleep', 'you have sleep ...');
echo "<html><head></head>";
echo "<body>";
echo "<form action='use_radio.php' method='GET'>";
echo "<input type='radio' name='radio' value='eat'>Eat</input>";
echo "<input type='radio' name='radio' value='drink'>Drink</input>";
echo "<input type='radio' name='radio' value='sleep'>Sleep</input>";
echo "<input type='submit' name='search_radio' value='Button' />";
echo "</form>";
$radio_name = $_GET['radio'];
//echo $radio_name;
mysql_connect("localhost","charles","charles");
mysql_select_db("test");
$query = 'select * from php_radio where name = "'.$radio_name.'"';
//echo $query;
$result = mysql_query($query) or die("query error: ".mysql_error());
while($aa = mysql_fetch_assoc($result)){
echo $aa['id']." ";
echo $aa['name']." ";
echo $aa['description']."<br>";
}
//mysql_free_result($result);
echo "</body>";
echo "</html>"
?>
相关文档:
apache的源码安装
将压缩包解压之后进入相应的目录
./configure \ #--------------------预编译命令
"--prefix=/usr/local/apache" \ #--------------------安装路径为“/usr/local/apache”
"--with-included-apr" \
"--enable-so" \ #--------------------开启相应的扩展模块 ......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>PHP分页</tit ......
/***************************by
garcon1986********************************/
<?php
// simple assgin the values
$arr1 = array(12 => 10, 'sjg' => 'yaya');
echo $arr1[12].'<br>'; // 10
echo $arr1['sjg']."<br>"; //yaya
echo "wo ai ni !<p> ......
/*********************************************************************************************
*****************************php二级联动菜单改动版***********************************
****************************************by garcon1986*****************************************
********************* ......