md82
June 20, 2010, 3:03am
1
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
md82
June 22, 2010, 12:12pm
2
<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
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());