Есть готовый самописный движок интернет магазина ( взят с видео курса ) но автор что то не учел и не работает нормально покупка товаров , а именно не вносятся в базу данных данные который вводит покупатель. регистрируется только дата и сам товар , но то что вводит человек в поля не появляется
вот скрин таблицы куда вводятся данные
http://i065[dot]radikal[dot]ru/1401/06/9c8cb39164b2[dot]png
и вот пустые поля где должны быть имена адреса итд - есть только модель ПК цена и дата и количество
вот код страницы оформление заказа
PHP:
скопировать код в буфер обмена
<h2 align="center">Оформление заказа</h2> <? if($_SESSION['cart'] && !isset($_POST['order'])) { ?> <form action="index.php?view=order" method="post" id="cart-form"> <table id="mycart" align="center" cellspacing="0" cellpadding="0" border="0"> <tr> <th>Товар</th> <th>Цена</th> <th>Кол-во</th> <th>общая сумма</th> </tr> <? foreach($_SESSION['cart'] as $id => $quantity): $product = get_product($id); ?> <tr> <td align="center"><?=$product['title'];?></td> <td align="center">$ <?=number_format($product['price'],2 );?></td> <td align="center"><?=$quantity;?></td> <td align="center">$ <?=number_format($product['price'] * $quantity ,2 );?></td> </tr> <?endforeach;?> </table> <p class="total" align="center">Общая сумма заказа: <span class="product-price"> <?=number_format($_SESSION['total_price'],2 );?> $</span></p> <p align="center" style="color: #fff;"> Ваше Имя: <input type="text" name="name" /> Ваша Фамилия: <input type="text" name="s_name" /> Ваш адрес: <input type="text" name="address" /> Почтовый индекс: <input type="text" name="post_index" /> Ваш e-mail: <input type="text" name="email" /> </p> <p align="center"><input type="submit" name="order" value="Заказать" /></p> </form> <? } if($_SESSION['cart'] && isset($_POST['order'])) { foreach($_POST as $ArrKey => $ArrStr) { $ArrKey = $_POST[$ArrKey]; } foreach($_SESSION['cart'] as $id => $quantity): $product = get_product($id); $query = mysql_query("INSERT INTO orders(name,s_name,address,post_index,email,date,time,product,prod_id,price,qty) VALUES ('$name','$s_name','$address','$post_index','$email','$date','$time','{$product['title']}','{$product['id']}','{$product['price']}','$quantity')"); endforeach; echo "<p align='center' style='color: #fff;'>Ваш заказ успешно принят! Спасибо за покупку!</p>"; } ?>
(Отредактировано автором: 07 Января, 2014 - 18:39:21)
|