Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form method="post" action="script.php">
- Please enter your information:
- <br>
- City: <input type="text" name="name"/>
- Month: <input type="text" name="month"/>
- Year: <input type="text" name="year"/>
- <br>
- <br>
- Please choose the kinds of weather you experienced from the list below.
- <br> Choose all that apply.
- <br> <br>
- <input type="checkbox" name="weather[]" value="sunshine" />Sunshine<br />
- <input type="checkbox" name="weather[]" value="clouds" />Clouds<br />
- <input type="checkbox" name="weather[]" value="rain" />Rain<br />
- <input type="checkbox" name="weather[]" value="hail" />Hail<br />
- <input type="checkbox" name="weather[]" value="sleet" />Sleet<br />
- <input type="checkbox" name="weather[]" value="snow" />Snow<br />
- <input type="checkbox" name="weather[]" value="wind" />Wind<br />
- <input type="checkbox" name="weather[]" value="cold" />Cold<br />
- <input type="checkbox" name="weather[]" value="heat" />Heat<br />
- <input type="submit" name="submit" value="Go">
- </form>
- ____________________________________________________________________new file
- <?php
- if (isset($_POST['submit'])) {
- $inputLocal = array($_POST['name'], $_POST['month'], $_POST['year']);
- $weatherr = array($_POST['weather']); }
- echo "In $inputLocal[0] in the month of $inputLocal[1] $inputLocal[2] you observed the following weather.";
- echo "<ul>";
- //$cnt = count($weatherr);
- // for ($i=0;$i<$cnt;$i++)
- //{echo "<li>".$weatherr[$i]."</li>";}
- foreach($weatherr as $weather){
- foreach($weather as $key => $val){
- echo "$key: $val";
- }
- }
- echo "</ul>";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement