添加字段集后PHP网页帖子不起作用

添加字段集后PHP网页帖子不起作用,php,html,post,Php,Html,Post,我制作了一个非常简单的PHP网页,向以太网设备发送命令字符串。在我用字段集修改它之后,它就不再发布数据了 以下是工作网页: <!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"> <?php

我制作了一个非常简单的PHP网页,向以太网设备发送命令字符串。在我用字段集修改它之后,它就不再发布数据了

以下是工作网页:

<!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">

<?php

// Checks to see if button pressed
if(isset($_POST['input'])) {

// Assigns value of button press to $input variable
$input=$_POST['input'];
//echo "$input<br />";

// Open the socket to the IP address
$sock = fsockopen('192.168.5.30:4660', NULL, $errno, $errstr);

// Send the value of the button press to the IP address
fwrite($sock, $input);

// Display the response from the socket on the webpage
echo fread($sock, 4096)."\n";

// Close the socket
fclose($sock); }

// If input is not set, then wait
else {
   // Input is not set, do something about it, raise an error, throw an exception, or whatever


}
?>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Audio Control</title>
</head>

<body>
<form method="post" action="">
<button name="input" value="CL1I1O1T" type="submit">Input 1</button>
<br />
<br />
<button name="input" value="CL1I2O1T" type="submit">Input 2</button>
<br />
<br />
<button name="input" value="CL1I3O1T" type="submit">Input 3</button>
<br />
<br />
<button name="input" value="CL1I4O1T" type="submit">Input 4</button>
<br />
<br />
<button name="input" value="CL1I5O1T" type="submit">Input 5</button>
<br />
<br />
<button name="input" value="CL1I6O1T" type="submit">Input 6</button>
<br />
<br />
<button name="input" value="CL1I7O1T" type="submit">Input 7</button>
<br />
<br />
<button name="input" value="CL1I8O1T" type="submit">Input 8</button>
<br />
<br />
<button name="input" value="DL1O1T" type="submit">Output 1 Off</button>
<br />
<br />

</form>
</body>
</html>

音频控制
输入1


输入2

投入3

输入4

输入5

输入6

输入7

输入8

输出1关

这是修改后的版本,不起作用。。。有什么想法吗

<!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">

<?php

// Checks to see if button pressed
if(isset($_POST['input'])) {

// Assigns value of button press to $input variable
$input=$_POST['input'];
//echo "$input<br />";

// Open the socket to the IP address
$sock = fsockopen('192.168.5.30:4660', NULL, $errno, $errstr);

// Send the value of the button press to the IP address
fwrite($sock, $input);

// Display the response from the socket on the webpage
echo fread($sock, 4096)."\n";

   // Close the socket
fclose($sock); }

    // If input is not set, then wait
else {
   //input is not set, do something about it, raise an error, throw an exception, or whatever


}
?>


<head>
<style type="text/css">
<!--
body {
font: 100% Verdana, Arial, Helvetica, sans-serif;
background: #666666;
margin: 0; 
padding: 0;
text-align: center;
color: #000000;
}

.newStyle1 {
float: left; 
}

.auto-style1 {
color: #FFFFFF;
font-size: 20px;
}

</style>
<title>Audio Control</title>
</head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<body>

<form action="" method="post" >


<fieldset style="display:inline; border:none; padding:0px; margin:0px; vertical-align:top; class="newStyle1" style="height: 450px" >
  <legend align="center"; class="auto-style1">Backyard Audio</legend>
  <br/>
  <button name="input1" style="height: 1.8em; width: 10em; font-size: 16px;" value="CL2I1O1T" type="submit">Computer</button>
  <br />
  <br />
  <button name="input2" style="height: 1.8em; width: 10em; font-size: 16px;" value="CL2I2O1T" type="submit">Tuner</button>
  <br />
  <br />
  <button name="input3" style="height: 1.8em; width: 10em; font-size: 16px;" value="CL2I3O1T" type="submit">Input 3</button>
  <br />
  <br />
  <button name="input4" style="height: 1.8em; width: 10em; font-size: 16px;" value="CL2I4O1T" type="submit">Input 4</button>
  <br />
  <br />
  <button name="input5" style="height: 1.8em; width: 10em; font-size: 16px;" value="CL2I5O1T" type="submit">Input 5</button>
  <br />
  <br />
  <button name="input6" style="height: 1.8em; width: 10em; font-size: 16px;" value="CL2I6O1T" type="submit">Input 6</button>
  <br />
  <br />
  <button name="input7" style="height: 1.8em; width: 10em; font-size: 16px;" value="CL2I7O1T" type="submit">Input 7</button>
  <br />
  <br />
  <button name="input8" style="height: 1.8em; width: 10em; font-size: 16px;" value="CL2I8O1T" type="submit">Input 8</button>
  <br />
  <br />
  <button name="input9" style="height: 1.8em; width: 10em; font-size: 16px;" value="DL2O1T" type="submit">Backyard Audio Off</button>
  <br />
  <br />
</fieldset>


</form>
</body>
</html>


您更改了按钮的名称(实际上是所有按钮)


您已经在CSS之前开始了一条HTML注释,但没有将其关闭

<style type="text/css">
<!-- 


要检查表单是否已提交,您可以使用:

如果(!空($\u POST))

要检查特定的提交按钮,您可以使用:

$_POST['input']

哇,真不敢相信我错过了!谢谢你的帮助,现在可以用了!同时检查@Sameer的评论。删除HTML注释。
$_POST['input']