I am trying to create a selection list using PHP scripting and variables. I keep getting this error though...
Parse error: syntax error, unexpected T_STRING in /home/12345/public_html/av/tv.php on line 7
my code is posted below. Nt quite sure what I am doing wrong. This is pretty much agoby from the example in PHP & MySWL For Dummiers 4th edition Listing 8-8: Building a Selection List Page 243. Any ideas? Thank you for your help.
<?php
$user=”12345”;
$host=”localhost”;
$password=”12345”;
$database = “12345”;
$cxn = mysqli_connect($host,$user,$password,$database);
$query = “SELECT TEMPERATURE, HUMIDITY, CO2 FROM ANALOG_SENSORS";
$result = mysqli_query($cxn,$query);
?>
<html>
<head>
<title>Sensor Type</title>
</head>
<body>
<form action=’processform.php’ method=’POST’>
<select name=’Sensor Type’>
<?php
while($row = mysqli_fetch_assoc($result))
{
extract($row);
echo “<option value=’$TEMPERATURE’>$TEMPERATURE</option>\n”;
echo “<option value=’$HUMIDITY’>$HUMIDITY</option>\n”;
echo “<option value=’$CO2’>$CO2</option>\n”;
}
?>
</select>
<input type=’submit’ value=’Select Type of Sensor’ />
</form>
</body>
</html>
您正在使用您的代码错误引号或者双“
为"
单一个'
应该是'
,只是改变它们在你的代码。
<select name=’Sensor Type’>
为什么在name属性的单词之间留空格?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.