Get Weather - Step 1 - Simple HTML Form...


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <html>
  2. <form method="post" action="MyWeather.php">
  3. <input type="text" name="city">
  4. <input type="submit" value="go!">
  5. </form>
  6. </html>
  7.  
  8.  
  9. <?php
  10.  
  11. $city=$_POST['city'];
  12.  
  13. if ($city != ""){
  14.  
  15. $res = shell_exec("./getWdr.sh {$city}");
  16.  
  17. echo "Weather in {$city}: [high,low] ". $res;
  18. }
  19. else
  20. echo "no city...";
  21.  
  22.  
  23. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.