Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include 'config.php';
- db_connect();
- check_login();
- session_start();
- if(!isset($_SESSION['koszyk'])){
- $_SESSION['koszyk'] = array();
- }
- if (isset($_GET['reset']))
- {
- unset($_SESSION['koszyk']);
- header('location: ' . $_SERVER['PHP_SELF'] . '?' . SID);
- exit();
- }
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1-strict.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>Twój koszyk zakupów </title>
- <meta http-enquiv="content-type" content="text/html; charset=iso-8859-2" />
- </head>
- <body>
- <h1> Twój koszyk z zakupami</h1>
- <?php // defninicja tablic z towarami
- $result=mysql_query("SELECT USLUGA_NAZWA_USLUGI FROM `USLUGA`");
- $i=0;
- while($row=mysql_fetch_array($result)) {
- $towary[$i]=$row['USLUGA_NAZWA_USLUGI'];
- $i++;
- };
- $result2= mysql_query("SELECT USLUGA_CENA_NETTO FROM `USLUGA`");
- $i =0;
- while($row=mysql_fetch_array($result2)) {
- $ceny[$i]=$row['USLUGA_CENA_NETTO'];
- $i++;
- };
- ?>
- <table border="1">
- <thead>
- <tr>
- <th>Opis towaru</th>
- <th>Cena</th>
- </tr>
- <thead>
- <tbody>
- <?php
- $suma = 0;
- for($i=0; $i<count($_SESSION['koszyk']); $i++)
- {
- echo '<tr>';
- echo '<td>'.$towary[$_SESSION['koszyk'][$i]] .'</td>';
- echo '<td align="right">';
- echo number_format($ceny[$_SESSION['koszyk'][$i]],2);
- echo 'złotych</td></tr>';
- $suma = $suma + $ceny[$_SESSION['koszyk'][$i]];
- }
- ?>
- </tbody>
- <tfoot>
- <tr>
- <th align="right">Należność: </th><br>
- <th align="right"><?php echo number_format($suma,2); ?> złotych.
- </th>
- </tr>
- </tfoot>
- </table>
- <p <a href="towary.php">Kupuj dalej</a> lub też : <a href=<?php echo $_SERVER['PHP_SELF']; ?>?reset=1">Wyczyć swój koszyk </a></p>
- </body>
- </html>
RAW Paste Data