<?php
/**
* Created by Phpstorm.
* User:lenovo
* DATE:2016/4/1
* Time:17:10
*/
Header (' Content-type:text/html;charset=utf-8 ');
Get converted numbers and convert into
$num = isset ($_post[' num ')? $_post[' num ']: ';
$connect = isset ($_post[' Connect ')? $_post[' Connect ']: ';
For saving selected, to enable the display of conversion relationships
$mark 1= $mark 2= $mark 3 = "";
if (! $connect) {
$mark 1 = "Selected";
}
Judging transformation relationships and achieving conversions
Switch ($connect) {
Case "10to2":
$score = Decbin ($num);
$mark 1 = "Selected";
Break
Case "10to8":
$score = Decoct ($num);
$mark 2 = "selected";
Break
Case "10TO16":
$score = Dechex ($num);
$mark 3 = "selected";
Break
}
?>
<title> Digital Conversion </title>
<meta charset= "UTF-8" >
<body>
<form action= "shuzizhuanhuan.php" method= "POST" >
Number: <input type= "text" name= "num" id= "input2" value = "<?php echo $num;?>"/>
<select name= "Connect" id = "Select1" >
<option value= "10to2" <?php echo $mark 1;?>>10to2</option>
<option value= "10to8" <?php echo $mark 2;?>>10to8</option>
<option value= "10to16" <?php echo $mark 3;?>>10to16</option>
</select>
<input type= "Submit" value= "Convert" >
<input type= "text" value= "<?php $score = Isset ($score)? $score:"; echo $score;?> "id=" input1 "/>
</form>
</body>
10 conversion into other binary systems