having a slight problem with admin interface
Posted: Mon May 08, 2006 6:47 am
heres the code:
for some reason none of it is reaching the mysql qury string and there by not being entered into DB, any suggestions?
also if i swap the isset for !empty then it prints out absolutely nothing?!
for some reason none of it is reaching the mysql qury string and there by not being entered into DB, any suggestions?
also if i swap the isset for !empty then it prints out absolutely nothing?!
Code: Select all
<?php
session_start();
require_once 'functions.php';
connectDB();
error_reporting(E_ALL);
echo '
<table>
<tr>
<td>
<a href="adminInterface.php?op=editShop">Edit Shop Items</a>
</td>
<td>
<a href="adminInterface.php?op=viewOrders">View Orders</a>
</td>
<td>
<a href="adminInterface.php?op=logOut">Log out</a>
</td>
</table>
';
switch($_GET['op'])
{
case('editShop'):
echo'
<table>
<form method="post" action="adminInterface.php">
Enter Product Name: 
<input type="text" name="productName"><br>
Enter Product Price: 
<input type="text" name="productPrice"><br>
Enter Product Unit: 
<input type="text" name="productUnit"><br>
<input type="button" name="Submit" value="update">
</form>
</table>';
}
if(isset($_POST['productName'], $_POST['productPrice'], $_POST['productUnit']))
{
$pName = $_POST['productName'];
$pPrice = $_POST['productPrice'];
$pUnit = $_POST['productUnit'];
$pName = mysql_real_escape_string($pName);
$pPrice = mysql_real_escape_string($pPrice);
$pUnit = mysql_real_escape_string($pUnit);
updateItems($pName, $pPrice, $pUnit);
}
function updateItems($pName, $pPrice, $pUnit)
{
$query='
INSERT INTO
MarkoPood
(name, hind, yhik)
values ("' . $pName . '","' . $pPrice . '","' . $pUnit . '")
';
mysql_query($query) or die(mysql_error());
}
?>