# Request: Display data from pirep custom fields

**URL:** <https://forum.phpvms.net/t/request-display-data-from-pirep-custom-fields/2888>\
**Category:** Development Help\
**Created:** [June 20, 2010, 3:03am UTC](https://forum.phpvms.net/t/request-display-data-from-pirep-custom-fields/2888 "2010-06-20T03:03:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![md82](https://forum.phpvms.net/letter_avatar_proxy/v4/letter/m/3da27b/32.png) [@md82](https://forum.phpvms.net/u/md82)\
**Post date:** [June 20, 2010, 3:03am UTC](https://forum.phpvms.net/t/request-display-data-from-pirep-custom-fields/2888/1 "2010-06-20T03:03:47Z")

</div>

basically I want to take information from custom pirep fields and display it in my airline stats. Example: I added a custom dropdown field in the file pirep page to specify if that pilot flew online or not… I want have an “online flights” total number in the airline stats page..

thanks for all the help

---

<div class="post-metadata">

**Author:** ![md82](https://forum.phpvms.net/letter_avatar_proxy/v4/letter/m/3da27b/32.png) [@md82](https://forum.phpvms.net/u/md82)\
**Post date:** [June 22, 2010, 12:12pm UTC](https://forum.phpvms.net/t/request-display-data-from-pirep-custom-fields/2888/2 "2010-06-22T12:12:09Z")

</div>

> \<dt\>Pilot flown with:\</dt\>
> 
> \<dd\>
> 
> \<select name=“code” id=“code”\>
> 
> \<option value=“”\>Select Pilot Code\</option\>
> 
> \<?php
> 
> foreach($allpilots as $pilot)
> 
> {
> 
> $sel = ($\_POST[‘code’] == $pilot-\>code || $bid-\>pilotid == $pilot-\>pilotid)?‘selected’:‘’;
> 
> echo ‘\<option value="’.$pilot-\>id.‘" ‘.$sel.’\>’.$pilot-\>code.’ - ‘.$pilot-\>pilotid.’\</option\>';
> 
> }
> 
> ?\>
> 
> \</select\>
> 
> \</dd\>

attempting a custom dropdown pirep field that loads the pilot numbers example: AAY-1234

I get the dropdown but its not loading any pilot codes, and gives me an error at the top of the page..

thanks

---

<div class="post-metadata">

**Author:** ![simpilot](https://forum.phpvms.net/user_avatar/forum.phpvms.net/simpilot/32/26_2.png) [@simpilot](https://forum.phpvms.net/u/simpilot)\
**Post date:** [June 28, 2010, 3:10am UTC](https://forum.phpvms.net/t/request-display-data-from-pirep-custom-fields/2888/3 "2010-06-28T03:10:33Z")

</div>

Not sure exactly what you are trying to do but maybe this will work for you:

```
<select name="code" id="code">
<option value="">Select Pilot Code</option>
<?php
$allpilots = PilotData::getAllPilots();
foreach($allpilots as $pilot)
{
echo '<option value="'.$pilot->pilotid.'">'.$pilot->firstname.' '.$pilot->lastname.' - '.PilotData::getPilotCode($pilot->code, $pilot->pilotid).'</option>';
}
?>
</select>

```

This is pretty rough, you should be setting the variable in the module, not calling it in the template, like this-\>

```
$this->set('allpilots', PilotData::getAllPilots());

```
