Pomagam koledze przy pewnej stronce i chcielibyśmy żeby zawartość koszyka(1 plik) i zawartość karty zamówienia(2 plik) było wysyłane razem w zamówieniu.
Tak wygląda mój koszyk:
<h1>Koszyk</h1> <?php if($_GET['cart_add'] && $_GET['cart_szt']){ $add_id = $_GET['cart_add']; $db->query("SELECT id, name, price FROM offer WHERE id=$add_id"); $db->setFetchMode(2); $product = $db->get(); $product = $product[0]; $product['szt'] = $_GET['cart_szt']; $_SESSION['cart'][$add_id] = $product; } if($_GET['delete']){ $delete_id = $_GET['delete']; } if($_GET['modify']){ $mod_id = $_GET['modify']; $pcs = $_GET['cart_szt']; $_SESSION['cart']["$mod_id"]['szt'] = $pcs; } ?> <script type="text/javascript"> $(document).ready(function(){ $('.removefromcart').click(function(){ var id = $(this).data('id'); window.location = "shop.php?module=cart&delete="+id; }); $('.countpcs').click(function(){ var id = $(this).data('id'); var pcs = $(this).prev().val(); window.location = "shop.php?module=cart&modify="+id+"&cart_szt="+pcs; }); }); </script> <table id="cart"> <thead> <tr> <th>Towar</th> <th style="width:100px">cena</th> <th style="width:200px">sztuk</th> </tr> </thead> <tbody> <?php foreach ($_SESSION['cart'] as $cart):?> <tr> <td><?=$cart['name']?></td> <td align="center"><?=$cart['price']?> zł</td> <td> <div style="display:inline;"> <input type="text" style="width:35px;" value="<?=$cart['szt']?>" name="szt"> <input type="button" class="countpcs" data-id="<?=$cart['id']?>" value="Przelicz"> </div> <div style="display:inline;"> <input type="button" class="removefromcart" data-id="<?=$cart['id']?>" value="Usuń"> </div> </td> </tr> <?php $suma+=$cart['price']*$cart['szt'] ?> <?php endforeach; ?> <tr> <td align="center">Koszt cakowity:</td> <td></td> </tr> </tbody> </table> <h1 style="margin-top:25px">Złóż zamówienie</h1> <?php include_once "modules/orderform.php"; ?>
a tak wygląda karta zamównienia
<?php if($_POST) { require 'libs/phpmailer/class.phpmailer.php'; $imie=$_POST['name']; $miejscowosc=$_POST['city']; $email=$_POST['email']; $telefon=$_POST['phone']; $tresc=$_POST['content']; $message.="<p><strong>Koszyk</strong></p>"; $message.="<p><strong>Dane Zamówienia</strong></p>"; $message.="<strong>Imie i nazwisko / nazwa firmy: </strong> $imie <br /> \n"; $message.="<strong>Adres: </strong> $adres <br /> \n"; $message.="<strong>Miejscowość: </strong> $miejscowosc <br /> \n"; $message.="<strong>Telefon: </strong>$telefon <br /> \n"; $message.="<strong>Email: </strong>$email <br /> \n"; $message.="<strong>Uwagi: </strong> <br/>".$tresc."<br /> \n"; $mail = new PHPMailer(true); //defaults to using php "mail()"; the true param means it will throw exceptions on errors, which we need to catch try { $mail->CharSet = 'UTF-8'; $mail->AddReplyTo($email, $imie); $mail->AddAddress('ogniu88@gmail.com', 'Blue Orchid'); $mail->SetFrom($email, $imie); $mail->Subject = 'Nowe zamówienie ze strony'; //$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically $mail->MsgHTML($message); $mail->Send(); $sended = true; //echo "<p class='error'>Twój formularz został pomyślnie wysłany</p>\n"; //echo "<script type='text/javascript'>alert('Twój formularz został pomyślnie wysłany');</script>\n"; } catch (phpmailerException $e) { } catch (Exception $e) { } } ?> <form method="post" action="" id="contactForm"> <div class="form"> <?php if($sended):?> <div style="text-align:center;color:green;font-weight:bold;">Zamówienie zostało wysłane!</div> <?php endif; ?> <div> <label for="contact_name"><span class="star">*</span> Imię i nazwisko</label> <input placeholder="np. Jan Kowalski" value="" name="name" class="text required" id="contact_name"> </div> <div> <label for="contact_adress"><span class="star">*</span> Adres</label> <input placeholder="np. ul. Jerozolimska" name="adress" value="" class="text required" id="contact_adress"> </div> <div> <label for="contact_city"><span class="star">*</span> Miejscowość</label> <input placeholder="np. Bytom" name="city" value="" class="text required" id="contact_city"> </div> <div> <label for="contact_phone"><span class="star">*</span> Numer telefonu</label> <input placeholder="np. 48 123 456 789" name="phone" value="" class="text required" id="contact_phone"> </div> <div> <label for="contact_email"><span class="star">*</span> Adres e-mail</label> <input placeholder="np. twoj@adres.pl" name="email" value="" class="text required email" id="contact_email"> </div> <div> <label for="contact_content">Uwagi</label> </div> <div> <textarea cols="50" rows="10" name="content" class="textarea" placeholder="Twoje pytanie" id="contact_content"></textarea> </div> <div><p style="margin:5px 0;"><span class="star">*</span> Pola obowiązkowe</p></div> <div align="right"><input type="submit" value="Wyślij zamówienie"/></div> </div> </form> <script type="text/javascript"> $("#contactForm").validate(); </script>
Teraz na mejla wysyła się tylko zawartość karty zamówienia, czyli imię i nazwisko itp. a brakuje informacji z koszyka. Chciałbym prosić Was o pomoc
