php Calculator

 
 
                            
 
                                             $a2): 'NaN';
22         }
23         if(isset($_POST['mun']) ? 'mun': ''){
24             $a3 =  ($a1===0 && $a2===0) ? ($a1 * $a2): 'NaN';
25         }
26         if(isset($_POST['div']) ? '/' : ''){
27             $a3 =  ($a1 && $a2) ? ($a1 / $a2) : 'NaN';
28         }
29 
30     ?>
31 
32     数值1:<input type="number" name="a1" value='<?php echo $a1; ?>'/>
33     数值2:<input type="number" name="a2" value='<?php echo $a2; ?>'/>
34     <input type="submit" value="+"  name="add" />
35     <input type="submit" value="-"  name="sub" />
36     <input type="submit" value="*"  name="mun" />
37     <input type="submit" value="/"  name="div" />
38     <input  disabled='disabled' value='<?php echo $a3; ?>'>
39 </form>
40 
41 </body>
42 </html>

 

Guess you like

Origin www.cnblogs.com/vaso-me/p/11223630.html