form.php 667 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /**
  3. * Create a form for data submission.
  4. *
  5. * @uses $vars['body'] The body of the form (made up of other input/xxx views and html
  6. * @uses $vars['action'] URL of the action being called
  7. * @uses $vars['method'] Method (default POST)
  8. * @uses $vars['name'] Form name
  9. */
  10. if (isset($vars['name'])) {
  11. $name = "name=\"{$vars['name']}\"";
  12. } else {
  13. $name = '';
  14. }
  15. $body = $vars['body'];
  16. $action = $vars['action'];
  17. if (isset($vars['method'])) {
  18. $method = $vars['method'];
  19. } else {
  20. $method = 'POST';
  21. }
  22. $method = strtolower($method);
  23. ?>
  24. <form <?php echo $name; ?> action="<?php echo $action; ?>" method="<?php echo $method; ?>">
  25. <?php echo $body; ?>
  26. </form>