Beispiel #1
0
    // final select menu
    function __construct($itemArray = '')
    {
        $this->items = $itemArray;
    }
    private function buildOptions()
    {
        $this->options = "<option value=''>Select a Name</option>";
        foreach ($this->items as $item) {
            $this->options .= "<option value='" . $item . "'>" . $item . "</option>";
        }
    }
    private function buildSelect()
    {
        $this->selectMenu = "<select>" . $this->options . "</select>";
    }
    public function setOptions($array)
    {
        $this->items = $array;
    }
    public function makeMenu()
    {
        $this->buildOptions();
        $this->buildSelect();
        return $this->selectMenu;
    }
}
$myMenu = new selectMenu();
$myMenu->setOptions($myArray);
echo $myMenu->makeMenu();
Beispiel #2
0
<?php

include_once "selectMenu.php";
include_once "data.php";
?>

<form action="process.php" method="post">
  <label for="title">Title:</label><br>
  <?php 
$titleMenu = new selectMenu($titleArray, "Select a title.", "title");
echo $titleMenu->makeMenu();
?>
  <br>
  <label for="first_name">First Name:</label><br>
  <input type="text" name="first_name" id="first_name" autofocus>
  <br>
  <label for="last_name">Last Name:</label><br>
  <input type="text" name="last_name" id="last_name">
  <br>
  <label for="password">Password:</label><br>
  <input type="text" name="password" id="password">
  <br>
  <label for="beatle">Beatle:</label><br>
  <?php 
$beatlesMenu = new selectMenu($beatlesArray, "Select your favorite Beatle.", "beatle");
echo $beatlesMenu->makeMenu();
?>
  <input type="submit" value="submit">
  <input type="reset" value="reset">
</form>
Beispiel #3
0
        <input name="LastName" placeholder="Last Name" /></br>
    </div><br>
    <div>
        <label for="title">Title:</label>

        <?php 
$myMenu = new selectMenu();
$myMenu->setOptions($TitleArray);
echo $myMenu->makeMenu("Select a Title", "Title");
?>
    </div><br>
    <div>
        <label for="beatle">Beatle:</label>
        <?php 
$myMenu = new selectMenu();
$myMenu->setOptions($BeatleArray);
echo $myMenu->makeMenu("Select a Beatle", "Beatle");
?>
    </div><br>


    <input type="submit" value="Create User Name">

    <input type="reset" value="reset">
</form>

<style>
    div {margin-top: 5px; }
    textarea, input { border: dotted 1px blue; }

</style>
Beispiel #4
0
      </div>

      <div class="form-group">
        <label for="note">Note:</label>
        <input id="note" class="form-control" type="text" name="Note" value="<?php 
echo $Location->getLocationNote();
?>
">
      </div>

      <h3 class="text-center">Soil Type:</h3>

      <div class="form-group">
        <label for="soildropdown">Soil Type: </label>
        <?php 
echo $SoilMenu->makeMenu("Select a Soil Type", "SoilType", $SoilList);
?>
      </div>

      <div class="form-group">
        <label for="soilconditions">Soil Conditions:</label>
        <input id="soilconditions" class="form-control" type="text" name="SoilConditions" value="<?php 
echo $Plant->getPlantSoil();
?>
">
      </div>

      <h3 class="text-center">Weather Conditions:</h3>

      <div class="form-group">
        <label for="observationdate">Observation Date:</label>