Advertisement
blodwen_argent

Untitled

Feb 23rd, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. <form method="post" action="script.php">
  2. Please enter your information:
  3. <br>
  4. City: <input type="text" name="name"/>
  5. Month: <input type="text" name="month"/>
  6. Year: <input type="text" name="year"/>
  7. <br>
  8. <br>
  9. Please choose the kinds of weather you experienced from the list below.
  10. <br> Choose all that apply.
  11. <br> <br>
  12. <input type="checkbox" name="weather[]" value="sunshine" />Sunshine<br />
  13. <input type="checkbox" name="weather[]" value="clouds" />Clouds<br />
  14. <input type="checkbox" name="weather[]" value="rain" />Rain<br />
  15. <input type="checkbox" name="weather[]" value="hail" />Hail<br />
  16. <input type="checkbox" name="weather[]" value="sleet" />Sleet<br />
  17. <input type="checkbox" name="weather[]" value="snow" />Snow<br />
  18. <input type="checkbox" name="weather[]" value="wind" />Wind<br />
  19. <input type="checkbox" name="weather[]" value="cold" />Cold<br />
  20. <input type="checkbox" name="weather[]" value="heat" />Heat<br />
  21. <input type="submit" name="submit" value="Go">
  22. </form>
  23.  
  24. ____________________________________________________________________new file
  25.  
  26. <?php
  27. if (isset($_POST['submit'])) {
  28. $inputLocal = array($_POST['name'], $_POST['month'], $_POST['year']);
  29.  
  30. $weatherr = array($_POST['weather']); }
  31.  
  32. echo "In $inputLocal[0] in the month of $inputLocal[1] $inputLocal[2] you observed the following weather.";
  33.  
  34. echo "<ul>";
  35. //$cnt = count($weatherr);
  36. // for ($i=0;$i<$cnt;$i++)
  37. //{echo "<li>".$weatherr[$i]."</li>";}
  38. foreach($weatherr as $weather){
  39. foreach($weather as $key => $val){
  40. echo "$key: $val";
  41. }
  42. }
  43. echo "</ul>";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement