Advertisement
Guest User

php

a guest
May 9th, 2019
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.51 KB | None | 0 0
  1. <?php
  2.  
  3. $dataSelect = [3,5,10,15,20];
  4.  
  5. $select = '';
  6.  
  7. for($i=0; $i < count($dataSelect); $i++) {
  8.  
  9. $select .= '<option>'.$dataSelect[$i].'</option>';
  10.  
  11. }
  12.  
  13. if(isset($_POST['submit'])) {
  14.  
  15.     echo $_POST['pilih'];
  16. }
  17.  
  18. ?>
  19.  
  20. <!DOCTYPE html>
  21. <html>
  22. <head>
  23.     <title>Select Data</title>
  24. </head>
  25. <body>
  26.  
  27. <form action="tes.php" method="POST" enctype="multipart/form-data">
  28.  
  29. <select name="pilih"> <?php echo $select;?> </select>
  30.  
  31. <button type="submit" name="submit">Send Data</button>
  32.  
  33. </form>
  34.  
  35. </body>
  36. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement