Asked
            
        
        
            Active
            
        
            Viewed 44 times
        
    -3
            
            
         
    
    
        user9381416
        
- 3
- 1
- 
                    I am wondering why there is always a 'Notice' popping out?Ho can I solve the problem.Thanks – user9381416 Feb 20 '18 at 04:32
- 
                    welcome to SO , do not put screenshots as your question – sumit Feb 20 '18 at 04:33
- 
                    Okay.Sorry,I will change it.Thanks for the advice:) – user9381416 Feb 20 '18 at 04:35
- 
                    1take a look at [`isset()`](http://php.net/manual/en/function.isset.php) – Sean Feb 20 '18 at 04:39
- 
                    Possible duplicate of [PHP: "Notice: Undefined variable", "Notice: Undefined index", and "Notice: Undefined offset"](https://stackoverflow.com/questions/4261133/php-notice-undefined-variable-notice-undefined-index-and-notice-undef) – Sean Feb 20 '18 at 04:39
1 Answers
1
            <?php 
//if the calculate button is clicked them only the code will be executed
 if(isset($_POST["calculate_button_name"]))
   {
    $cityname=array("wIndianapolisw","New York","Tokyow","London"); 
    $from=filter_input(INPUT_POST,"wfrom"); 
    $to=filter_input(INPUT_POST,"wtom");  
    $distance=array(array(0,648,6476,4000),array(648,0,6760,3470),array(6476,6760,0,5956),array(4000,3470,5956,0)); 
    print "Distance from w4cityname[$from].” to w4cityname[Sto].• is w4distance[Sfrom][$to] .w miles"; 
   }
?>
 
    
    
        Hp_issei
        
- 579
- 6
- 18