Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="pl">
- <head>
- <meta charset="utf-8" />
- <title> php </title>
- <style type="text/css">
- table,td{
- border-style:solid;
- border-collapse:collapse;
- }
- tr:nth-child(2n){
- background-color:#f2afbf;
- }
- tr:nth-child(2n+1){
- background-color:#d1cfdf;
- }
- </style>
- </head>
- <body>
- <?php
- $str='<table>';
- $plik=file("produkty.txt");
- $n=count($plik);
- for($i=0; $i<$n;$i++){
- $str.='<tr>';
- $elementy=explode("\t",$plik[$i]);
- for($j=0;$j<5;$j++){
- $str.='<td>'.$elementy[$j].'</td>';
- if($i!=0 && $j==4) $cena+=$elementy[$j];
- }
- $str.='</tr>';
- }
- $str.='</table>';
- echo $str;
- echo 'wartosc produktow: '.$cena;
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement