I need to alter the code below to add some ‘hidden’ data. The hidden data would be automatically pulled from a table based on the admin’s login. This data could be a store name, zip code, web address, etc. I don’t want the admin to have to add this every time he completes the html form that links to the code below. I want the data to be pulled from a table associated with the admin’s id number, for example.
How and where would I add the code for this ‘hidden’ data? Using the html form (auto-filled) or in the actual insert code below? Thanks in advance for process thoughts and code thoughts.
[php]<?php
$catid=$_POST[‘catid’];
$description=$_POST[‘description’];
$price=$_POST[‘price’];
$quantity=$_POST[‘quantity’];
$restname=$_POST[‘custname’];
$restphone=$_POST[‘custphone’];
if (get_magic_quotes_gpc())
{
$catid = stripslashes($catid);
$description = stripslashes($description);
$price = stripslashes($price);
$quantity = stripslashes($quantity);
$restname = stripslashes($custname);
$restname = stripslashes($custphone);
}
$catid = mysql_real_escape_string($catid);
$description = mysql_real_escape_string($description);
$price = mysql_real_escape_string($price);
$quantity = mysql_real_escape_string($quantity);
$restname = mysql_real_escape_string($custname);
$restphone = mysql_real_escape_string($custphone);
$thumbnail = getThumb($_FILES[‘picture’]);
$thumbnail = mysql_real_escape_string($thumbnail);
$query = “INSERT INTO products (catid, description, picture, price, quantity, custname, custphone) " .
" VALUES (’$catid’,’$description’,’$thumbnail’, ‘$price’, ‘$quantity’, ‘$custname’, '$custphone)”;
$result = mysql_query($query) or die(‘Unable to add product’);
if ($result)
echo “
New product added
\n”;else
echo “
Problem adding new product
\n”;?> [/php]