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: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi,
(this is a new question /topic btw - moderators)
i have a select menu and when user selects an option, that one option will fetch 3 attributes from database.
The problem is it isnt working, can you check this code and tell me what is going on?
in php section, i add sessions:Code: Select all
<?php
session_start();
if (isset($_POST['AAatt'])) {
$_SESSION['quantity'] = $_REQUEST['quantity'];
$_SESSION['baseprice'] = $_REQUEST['baseprice'];
$_SESSION['weight'] = $_REQUEST['weight'];
}
?>Then i set the variables
Code: Select all
<?php
$quantity = $_REQUEST['quantity'];
$weight = $_REQUEST['weight'];
$baseprice = $_REQUEST['baseprice'];
?>Then in the HTML i make the select menu:
Code: Select all
<select name="AAatt" selected="selected" width="20" >
<option>Please Select </option>
<option value="<?php $data = mysql_query("SELECT weight, baseprice, quantity FROM b1_product WHERE id='1' ") or die(mysql_error()); ?> ">500</option>
(continued options - stripped down version for space on fourm )The connections to database is working, but it isn't returning the variables .
I then try to echo those variables out , but they dont exist.
Code: Select all
<?php
echo "$weight" . "$baseprice" . "$quantity";
?>I've tried to $_POST , etc on the variables. doesnt work.
My database is set up like this:
id | name | quantity | baseprice | weight |
-----------------------------------------------------
1 | widgetA | 500 | 650 | 75 |
etc.
Thank ya
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: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]