PHP怎么输出不出来呢?
<html><body><formaction=""method="post">数:<inputtype="text"name="nmb"value="<?phpecho...
<html>
<body>
<form action="" method = "post" >
数:<input type="text" name="nmb" value="<?php echo $nmb;?>" />
<select name="trans">
<option value='1'>10to2</option>
<option value='2'>10to8</option>
<option value='3'>10to16</option>
<option value='4'>2to10</option>
<option value='5'>8to10</option>
<option value='6'>16to10</option>
</select>
<input type="submit" name="sub" value="转换"/>
<input type="text" name="result" value="<?php echo $result;?>"/>
</form>
<?php
$$nmb = $result = "";
if($_POST){
$nmb= $_POST['nmb'];
$trans = $_POST['trans'];
if($trans == "1"){
$result=decbin((int)$nmb);
}else if($trans == "2"){
$result=decoct((int)$nmb);
}else if($trans == "3"){
$result=dechex((int)$nmb);
}else if($trans == "4"){
$result=bindec($nmb);
}else if($trans == "5"){
$result=octdec($nmb);
}else if($trans == "6"){
$result=hexdec($nmb);
}
}
?>
</body>
</html> 展开
<body>
<form action="" method = "post" >
数:<input type="text" name="nmb" value="<?php echo $nmb;?>" />
<select name="trans">
<option value='1'>10to2</option>
<option value='2'>10to8</option>
<option value='3'>10to16</option>
<option value='4'>2to10</option>
<option value='5'>8to10</option>
<option value='6'>16to10</option>
</select>
<input type="submit" name="sub" value="转换"/>
<input type="text" name="result" value="<?php echo $result;?>"/>
</form>
<?php
$$nmb = $result = "";
if($_POST){
$nmb= $_POST['nmb'];
$trans = $_POST['trans'];
if($trans == "1"){
$result=decbin((int)$nmb);
}else if($trans == "2"){
$result=decoct((int)$nmb);
}else if($trans == "3"){
$result=dechex((int)$nmb);
}else if($trans == "4"){
$result=bindec($nmb);
}else if($trans == "5"){
$result=octdec($nmb);
}else if($trans == "6"){
$result=hexdec($nmb);
}
}
?>
</body>
</html> 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询