multiple variables
Posted: Mon Jan 08, 2007 2:21 pm
feyd | Please use
all the other variables work and go to something else
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
ok i know that the question has probably been asked somewhere before but i jsut spent like an hour looking on forums and cant find the answer to it.
How do i set multiple values to a variable i.e. i am trying to set variables with check boxes and set the variables to the product id # in my sql database.
i can do that part fine. now when i go to pll the info back out of my variable i cant figure out how to make it pull EACH value independantly.
code shown belowCode: Select all
$edit = $_POST['edit'];
$page = $_POST['page'];
$select = $_POST['select'];
$onhand = $_POST['onhand'];
$value = $onhand + $_POST['value'];
$isitprint = $_POST['edit'];
$itis = 'Print';
mysql_select_db("inventory", $con);
ECHO '<script type="text/javascript"> function printpage() {frame.print()} </script>';
IF ($isitprint != $itis) {
ECHO '<head>';
ECHO '<meta http-equiv="refresh" content="5;url=';
ECHO '?page=';
ECHO $page;
ECHO '">';
ECHO '</head>';
}
SWITCH ($_POST['edit']) {
// if edit => Print
CASE 'Print':
$sel = "SELECT * FROM products
WHERE ProductID = '" . $select . "'";
$result = mysql_query($sel,$con);
IF (!mysql_query($sel,$con))
{
ECHO '<tr>';
ECHO '<td><CENTER>';
ECHO 'Error: ' . mysql_error();
ECHO '<br><a href="';
ECHO '?page=';
ECHO $page;
ECHO '">Go Back</a>';
ECHO '</td>';
ECHO '</tr>';
DIE();
} ELSEIF (mysql_query($sel,$con)) {
while($row = mysql_fetch_array($result))
{
echo '<tr>';
echo '<td style="border:none;">'.$row['ProductID'].'</td>';
echo '<td style="border:none;">'.$row['category'].'</td>';
echo '<td style="border:none;">'.$row['Supplier'].'</td>';
echo '<td style="border:none;">'.$row['Serial'].'</td>';
echo '<td style="border:none;">'.$row['Product'].'</td>';
echo '<td style="border:none;">'.$row['Description'].'</td>';
echo '<td style="border:none;">'.$row['LeadTime'].'</td>';
echo '<td style="border:none;">$ '.$row['UnitPrice'].'</td>';
echo '<td align=right style="border:none;"> '.$row['UnitsOnHand'].'</td>';
echo '</tr>';
}
}
BREAK;
}feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]