Advertisement
dimkiriaoks

forms

Nov 10th, 2022
732
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.50 KB | None | 0 0
  1. <?php
  2. function genera_form($action = "", $method="get", $csrf_name = "", $csrf_token = ""){
  3.     $uid = uuid();
  4.     ob_start();
  5.     ?>
  6.     <form action="<?= $action ?>" method="<?= $method ?>">
  7.         <input type="hidden" name="<?= $csrf_name ?>" value="<?= $csrf_token ?>">
  8.         <label for="name-<?= $uid ?>">Name</label>
  9.         <input type="text" id="name-<?= $uid ?>" name="name<?= $uid ?>">
  10.         <button type="submit">Submit</button>
  11.     </form>
  12.     <?php
  13.     return ob_get_clean();
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement