i tried it and it didn't work. bummer. i tried to use the order form and then check phpmyadmin and saw nothing in the table. so the first thing i did was run my php script to see what type of response i'd get. i got this message: "Connected to database
Array
(
)".
(although i don't know what is supposed to be in the array, errors perhaps? but it did take away the previous error message i was receiving regarding an integrity error and one of the values needed be set to null)
in any event, the good connection is there. next i made sure the correct string in the html code to access the php script was correct and it is. if i may here is the html:
<form id="shoppingCart" method="POST" class="form-inline" name="basket_form" action="myconnection/prac0.php">
Continue Shopping
<thead>
<tr>
<th colspan="2" class="description">
Item Description
</th>
<th class="size">
Temple
</th>
<th class="quantity">
Quantity
</th>
<th class="price">
Price
</th>
<th class="subtotal">
Subtotal
</th>
<th>
</th>
</tr>
</thead>
</table>
<table class="table">
<tbody>
<tr class="warning">
<td class="thumb" rowspan="2"><a href="javascript: void(0);" title="Link to product page"><img src="img/331.jpg" alt="" width="123" height="91" title="Product Image"></a></td>
<td class="description" rowspan="2">
<a class="item-name" href="javascript: void(0);" title="http://exxxx.co/vantage_poxxxx.html">The Minimum</a>
<div>
<div class="item-availability"><em>These Diamond Shape Spectacles Accentuate Anyone's Style and Grace</em>.</div>
<div class="item-sku">MDL331</div>
</div>
</td>
<td class="size">
<select class="span2" id="prod2_size1" name="prod2_size1">
<option value="Buffalo Horn" selected>Buffalo Horn</option>
<option value="Gold">Gold</option>
<option value="Rose Gold">Rose Gold</option>
<option value="White Gold">White Gold</option>
<option value="Titanium">Titanium</option>
<option value="Platinum">Platinum</option>
</select>
</td>
<td class="color">
<input type="hidden" id="prod2_color1" name="prod2_color1" value="no">
</td>
<td class="quantity">Qty: <input id="prod2_qty1" name="prod2_qty1" type="text" class="number" value="1" class="inline input-mini">
</td>
<td class="price">
<span class="currency">$</span><span class="amount">3000.00</span>
</td>
<td class="subtotal">
<span class="currency">$</span><span class="amount">3000.00</span>
</td>
<td class="remove">
<button class="btn btn-danger btn-mini" type="submit" name="prod2_remove1" value="remove_item" rel="tooltip" data-placement="left" data-original-title="Be careful! This item will be entirely removed from the basket!">
<i class="icon-remove icon-white"></i>
</button>
</td>
</tr>
<tr class="warning additional_empty">
<td class="empty_td" colspan="8">
</td>
</tr>
</tbody>
</table>
<table class="table">
<tbody>
<tr class="warning">
<td class="thumb" rowspan="2">
<a href="javascript: void(0);" title="http://eyexxxxint.html"><img src="img/332.JPG" width="123" height="91"></a></td>
<td rowspan="2" class="description">
<a class="item-name" href="javascript: void(0);" title="Link to product page">The Medium</a>
<div>
<div class="item-availability">
<p><em>Timeless Design, </em><em>A true work of art</em>, <em>High Quality Lenses, </em><em>A Comfortable Fit</em></p>
</div>
<div class="item-sku">MDL332</div>
</div>
</td>
<td class="size">
<select class="span2" id="prod2_size1" name="prod2_size1">
<option value="Buffalo Horn" selected>Buffalo Horn</option>
<option value="Gold">Gold</option>
<option value="Rose Gold">Rose Gold</option>
<option value="White Gold">White Gold</option>
<option value="Titanium">Titanium</option>
<option value="Platinum">Platinum</option>
</select>
</td>
<td class="color"><input type="hidden" id="prod2_color1" name="prod2_color1" value="no">
</td>
<td class="quantity">Qty: <input id="prod2_qty1" name="prod2_qty1" type="text" class="number" value="1" class="inline input-mini">
</td>
<td class="price">
<span class="currency">$</span><span class="amount">4000.00</span>
</td>
<td class="subtotal">
<span class="currency">$</span><span class="amount">4000.00</span>
</td>
<td class="remove">
<button class="btn btn-danger btn-mini" type="submit" name="prod2_remove1" value="remove_item" rel="tooltip" data-placement="left" data-original-title="Be careful! This item will be entirely removed from the basket!">
<i class="icon-remove icon-white"></i>
</button>
</td>
</tr>
<tr class="warning additional_empty">
<td class="empty_td" colspan="8">
</td>
</tr>
</tbody>
</table>
<table class="table">
<tbody>
<tr class="warning">
<td class="thumb" rowspan="2">
<a href="javascript: void(0);" title="Link to product page">
<img src="img/333.jpg" width="123" height="91" title="Product Image">
</a>
</td>
<td class="description" rowspan="2">
<a class="item-name" href="javascript: void(0);" title="Link to product page">The Maximum</a>
<div>
<div class="item-availability"><em>Rimless frames</em>, <em> Sophistication & *Elegance</em> by Design</div>
<div class="item-sku">MDL333</div>
</div>
</td>
<td class="size">
<select class="span2" id="prod2_size1" name="prod2_size1">
<option value="Buffalo Horn" selected>Buffalo Horn</option>
<option value="Gold">Gold</option>
<option value="Rose Gold">Rose Gold</option>
<option value="White Gold">White Gold</option>
<option value="Titanium">Titanium</option>
<option value="Platinum">Platinum</option>
</select>
</td>
<td class="color"><input type="hidden" id="prod2_color1" name="prod2_color1" value="no">
</td>
<td class="quantity"><label class="inline">Qty:</label><input id="prod2_qty1" name="prod2_qty1" type="text" class="number" value="1" class="inline input-mini">
</td>
<td class="price">
<span class="currency">$</span><span class="amount">5000.00</span>
</td>
<td class="subtotal">
<span class="currency">$</span><span class="amount">5000.00</span>
</td>
<td class="remove">
<button class="btn btn-danger btn-mini" type="submit" name="prod2_remove1" value="remove_item" rel="tooltip" data-placement="left" data-original-title="Be careful! This item will be entirely removed from the basket!">
<i class="icon-remove icon-white"></i>
</button>
and the php:
try {
$dbh = new PDO("mysql:host=$hostname;dbname=new_order", $username, $password);
$dbh->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT );
$dbh->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING );
$dbh->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
/*** echo a message saying we have connected ***/
echo 'Connected to database<br />';
?>
<body>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
$errors = [];
}
if(empty($errors)) {
echo "<pre>";
print_r($_POST);
echo "</pre>";
exit;
// prepare sql and bind parameters
$query = "INSERT INTO details (description, prod2_size1, prod2_qty1, price)
VALUES (:description, :prod2_size1, :prod2_qty1, :price)";
}
$stmt = $dbh->prepare($query);
$stmt->bindParam(':description', $_POST['description']);
$stmt->bindParam(':prod2_size1', $_POST['prod2_size1']);
$stmt->bindParam(':prod2_qty1', $_POST['prod2_qty1']);
$stmt->bindParam(':price', $_POST['price']);
$stmt->execute();
} catch (PDOException $exception) {
echo $exception->getMessage() . "<br />";
}
/*** close the database connection ***/
$dbh = null;
?>
just point me in the right direction. i'll do my own work. thanks, yall.