Exemplo n.º 1
0
    private $selectMenu;
    // 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();
Exemplo n.º 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>
Exemplo n.º 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; }
Exemplo n.º 4
0
        $Plant = new Plant();
    }
    if (isset($_SESSION['current_location'])) {
        $Location = $_SESSION['current_location'];
    } else {
        $Location = new Location();
    }
    if (isset($_SESSION['current_weather'])) {
        $Weather = $_SESSION['current_weather'];
    } else {
        $Weather = new weather();
    }
}
$Soil = new soil();
$SoilList = $Soil->GetAllSoils();
$SoilMenu = new selectMenu();
$SoilMenu->setOptions($SoilList);
include_once 'include/header.php';
if (isset($php_errormsg)) {
    ?>
    <h1> Please correct the following errors: <?php 
    $php_errormsg;
    ?>
</h1>
<?php 
}
?>

<div class="row">
  <div class="col-sm-4 col-sm-offset-4">
    <form action="SaveFlower.php" method="get">