Jump to content

Request: Display data from pirep custom fields


md82

Recommended Posts

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

Link to comment
Share on other sites

<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

Link to comment
Share on other sites

  • Administrators

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());

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...