PHP mail products sending problem

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

13MARKOKI
New php-forum User
New php-forum User
Posts: 1
Joined: Fri May 23, 2014 7:26 am

PHP mail products sending problem

Postby 13MARKOKI » Fri May 23, 2014 7:36 am

Hi, i hope that someone here can help me. I have building online shop with tutorials, and i am close to finish it, just one thing i can't make it work. Sorry for my bad English but i will try to explain. Every product and quantity whics visitor chose is printed on html in tables. When he chose products and quantity user just fill his personal data and when click send order comes to my mail. I know how to get personal data from inputs on my mail, know how to set that in sendmail.php, but i don't know how get products name and quantity for each, so i need if is that possible answer how to do that. Like i said, all cart content is printed in one table is there a way to send whole table content with sendmail.php on my mail? Please help this is the very last thing i need to complete my site :/ here is the code how cart is displaying products and quantity on html page for user

Code: Select all

<?php
$cartOutput = "";
$product_id_array = '';
$product_name = '';
$details = '';
if (!isset($_SESSION["cart_array"]) || count($_SESSION["cart_array"]) < 1) {
    $cartOutput = "<p align='right'>Vaša korpa je prazna</p>";
} else {

   
   $i = 0;
    foreach ($_SESSION["cart_array"] as $each_item) {
      $item_id = $each_item['item_id'];
      $sql = mysql_query("SELECT * FROM products WHERE id='$item_id' LIMIT 1");
      while ($row = mysql_fetch_array($sql)) {
         $product_name = $row["product_name"];
         $details = $row["details"];
      }
   
      $x = $i + 1;
      

      $product_id_array .= "$item_id-".$each_item['quantity'].",";

      $cartOutput .= "<tr>";
      $cartOutput .= '<td><a href="product.php?id=' . $item_id . '">' . $product_name . '</a><br /><img src="inventory_images/' . $item_id . '.jpg" alt="' . $product_name. '" width="70" height="80" border="1" /></td>';
      $cartOutput .= '<td>' . $details . '</td>';
      $cartOutput .= '<td><form action="cart.php" method="post" >
        <input name="quantity[]" type="text" value="' . $each_item['quantity'] . '" size="1" maxlength="2" />
      
      <input name="item_to_adjust" type="hidden" value="' . $item_id . '" />
      </form></td>';
   
      $cartOutput .= '<td><form action="cart.php" method="post"><input name="deleteBtn' . $item_id . '" type="submit" value="Obriši iz korpe" class="btn-style"/><input name="index_to_remove" type="hidden" value="' . $i . '" /></form></td>';
      $cartOutput .= '</tr>';
      $i++;
    }

Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 2 guests