Ejemplo n.º 1
0
<?php 
// Ouputs the area of rectangle with the given height and width
function areaRect($height, $width)
{
    $area = $height * $width;
    $message = "A rectangle of height {$height} and width {$width} has an area of {$area}.";
    return $message;
}
// Some result variables
$result_area;
$input_height = $input_width = 0;
// Modify height and width with new input
if ($_SERVER["REQUEST_METHOD"] === "POST" && !is_null($_POST["height"]) && !is_null($_POST["width"])) {
    $input_height = (int) test_input($_POST["height"]);
    $input_width = (int) test_input($_POST["width"]);
    $result_area = areaRect($input_height, $input_width);
}
?>
</pre>
<form action="<?php 
echo htmlspecialchars($_SERVER["PHP_SELF"]);
?>
" method="POST"
  accept-charset="utf-8" >
  <p>
    <label>Height:<br>
      <input type="number" name="height" min="0" required
       value="<?php 
echo $input_height;
?>
">
function plBoxes($pdf, $layout)
{
    // note that fill is blank
    $pdf->SetFillColor(0, 0, 0);
    $pdf->SetTextColor(128, 128, 128);
    $pdf->SetLineWidth(0.025);
    areaRect($pdf, $layout["area"]);
    $pdf->SetLineWidth(0.01);
    areaRect($pdf, $layout["title"]);
    areaRect($pdf, $layout["customer"]);
    areaRect($pdf, $layout["status"]);
    areaRect($pdf, $layout["items"]);
    areaRect($pdf, $layout["shipping"]);
}