using label

7 posts by 3 authors in: Forums > CMS Builder
Last Post: August 12, 2011   (RSS)

By Toledoh - August 10, 2011

Hi Guys.

I'm currently using $emailProject = @$_REQUEST['project']; which returns a number as the value. How can I do something like: $emailProject = @$_REQUEST['project:label'];
Cheers,

Tim (toledoh.com.au)

Re: [Toledoh] using label

By Dave - August 10, 2011

Tim,

We'd have to pull it out of the database somehow. Are you loading any records on the same page? And where is the project num/name stored? In another table or in a list of values in the field editor?
Dave Edis - Senior Developer
interactivetools.com

Re: [Toledoh] using label

By Jason - August 11, 2011

Hi Tim,

You can use getListOptions() to get an array of all of the value/label combinations and then use the $_REQUEST['project'] value to get the label you want. For example:

<?php
$listOptions = getListOptions('accounts', 'project');

$emailProject = "";

if (@$_REQUEST['project']) {
$emailProject = $listOptions[@$_REQUEST['project']];
}

?>


Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] using label

By Toledoh - August 11, 2011

Hi Jason.

That's still returning the value, not the label.

"project" is a list with value=num and label=title.

So when I use this $_REQUEST['project'] I get the "num" but I want to display the "title"...
Cheers,

Tim (toledoh.com.au)

Re: [Toledoh] using label

By Jason - August 12, 2011

Hi Tim,

Instead of referencing $_REQUEST['project'] directly, you should be able to get the label by using the code above and referencing:
$listOptions[@$_REQUEST['project']];

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] using label

By Toledoh - August 12, 2011

Hi Jason.

My mistake, I still had "$emailProject = @$_REQUEST['project'];" later in the code, left over from me trying to get it to work.

You'r version works great! Thanks
Cheers,

Tim (toledoh.com.au)