Advertisement
sueckreimir

dataIndex

Sep 24th, 2019
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.72 KB | None | 0 0
  1. #ispit Index.php
  2. <!DOCTYPE html>
  3. <!--
  4. To change this license header, choose License Headers in Project Properties.
  5. To change this template file, choose Tools | Templates
  6. and open the template in the editor.
  7. -->
  8. <html>
  9.     <head>
  10.         <meta charset="UTF-8">
  11.         <title>Tablica</title>
  12.     </head>
  13.    
  14.     <body>
  15.         <?php
  16.        
  17.         require 'data.php';
  18.        
  19.         echo '<table border="2">';
  20.         echo '<tr><th>'.' '.'<th>'.
  21.                       'Ime'.'<th>'.
  22.                   'Prezime'.'<th>'.
  23.                     'Datum'.'<th>'.
  24.                   'Placeno'.'<tr>';
  25.        
  26.         foreach($data as $key=>$val)
  27.         {
  28.             echo '<tr><td>'.$key.'<td>'.
  29.                             $val['ime'].'<td>'.
  30.                             $val['prezime'].'<td>'.
  31.                             datum($val['datum']).'<td>';
  32.             echo '<select>';
  33.             if($val['placeno']=='Da')
  34.             {
  35.                 echo '<option>'.'Da'.'</option>';
  36.                 echo '<option>'.'Ne'.'</option>';
  37.             }
  38.             elseif($val['placeno']=='Ne')
  39.             {
  40.                 echo '<option>'.'Ne'.'</option>';
  41.                 echo '<option>'.'Da'.'</option>';
  42.             }
  43.             else
  44.             {
  45.                 echo '<option>'.'Greška pri unosu'.'</option>';
  46.             }
  47.             echo '</select>';
  48.         }
  49.        
  50.         echo '</table>';
  51.        
  52.         function datum($subject)
  53.         {
  54.             $delimiter='/[-]/';
  55.            
  56.             $polje= preg_split($delimiter, $subject);
  57.             return $polje[0].' '.$polje[1].' '.$polje[2];
  58.         }
  59.        
  60.        
  61.        
  62.        
  63.        
  64.         ?>
  65.     </body>
  66. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement