Esempio n. 1
0
    <div id="info">
	<h2>Survey Data</h2>
	<hr>
		
	<form action="view.php" method="post">	
	 <select name="sort">
	  <option value="day">Today</option>
	  <option value="month">This Month</option>
	  <option value="year">This Year</option>
	 </select> 
	 
	  <select name="sites">
	 
	 <?php 
$db1 = new db1();
$accessSites = $db1->getAccessSites();
$self = htmlspecialchars($_SERVER["PHP_SELF"]);
//The information of the form will be sent back to self. This is done to change the content of the page when the submit button is clicked.
$numberOfSites = count($accessSites['SiteID']);
//Number of sites found in the database is equal to number of site IDs.
echo "<form method='post' action='{$self}'>";
//This is the HTML form header.
for ($i = 1; $i <= $numberOfSites; $i++) {
    $SiteName = $accessSites['SiteName'][$i - 1];
    $SiteID = $accessSites['SiteID'][$i - 1];
    echo "<option value='{$SiteID}'>{$SiteName}</option>";
}
?>
		<input type="submit" value="Sort">
	
	<?php 
    public function viewAccessSites()
    {
        $db1 = new db1();
        $accessSites = $db1->getAccessSites();
        $self = htmlspecialchars($_SERVER["PHP_SELF"]);
        //The information of the form will be sent back to self. This is done to change the content of the page when the submit button is clicked.
        $numberOfSites = count($accessSites['SiteID']);
        //Number of sites found in the database is equal to number of site IDs.
        echo "<form method='post' action='{$self}'>";
        //This is the HTML form header.
        for ($i = 1; $i <= $numberOfSites; $i++) {
            echo $i;
            $SiteName = $accessSites['SiteName'][$i - 1];
            $SiteID = $accessSites['SiteID'][$i - 1];
            echo <<<_END
<input type='radio' name='SiteID' value={$SiteID}>
{$SiteName} <br/>
_END;
        }
        //The for loop is used to loop through the list of surveys. Each survey will be presented as a radio button. Surveys are labeled by time, status, state, and boat type.
        echo "<input type='submit' name='submitButton' value='Edit/Flag' ></input>";
        echo "</form>";
    }