variables not getting the right values

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I have a form that has the ID values of various fields from listboxes, etc.,  
which are generated from a db query, assigned to variables.  The variables  
hold the returned $_POST['fieldvalue'] fine, but I also need variables to  
hold the labels.  I have tried a few options such as running a secondary  
query where the selected form value  =  the label, i.e.

-sample code-

//set variables:

$tooltype_id = $_POST['toolType'];
$toolcat_id = $_POST['toolCat'];
$primeproj_id = $_POST['project'];

//get group and project code and set variables

$query_groupcode = "SELECT groupCode, projCode from groups, proj WHERE  
groups.groupID = proj.groupID AND proj.projID = '$primeproj_id'";
$groupname = $query_groupcode['groupCode'];
$projcode = $row_projects['projCode'];

//get tooltype codes

$query_toolpath = "SELECT toolType FROM toolType WHERE toolTypeID =  
$tooltype = $query_toolpath['toolType'];
- end code -

I then checked to see the variable values:

-code sample-
echo $tooltype_id.' tooltype_id<br />';
echo $toolcat_id.' toolcat_id<br />';
echo $primeproj_id.' primeproj_id<br />';
echo $groupname.' groupname<br />';
echo $projcode.' projcode<br />';
echo $tooltype.' tooltype<br />';
-end code-

this is the result - the data from the db comes across only as 'S':

2 tooltype_id
3 toolcat_id
5 primeproj_id
S groupname
S projcode
S tooltype

I'm sure this is just a stupid little error that I'm not seeing....or that  
there is a reasonable way to collect the label values.  

Re: variables not getting the right values

I got it - I was referencing the query arrary incorrectly.

Quoted text here. Click to load it

Site Timeline