All pastes #279604 Raw Edit

Unnamed

public text v1 · immutable
·published 2006-12-15 04:27 UTC
rendered paste body
		  echo '<tr>';
				echo '<td> ';
				  echo '<div align="right"><b><font color="#840000" face="Verdana, Arial, Helvetica, sans-serif" size="2">Aircraft Type :</font></b></div>';
				echo '</td>';
				echo '<td>';
				  echo '<select name="ac_type" size="1">';
				  // The A/C include list needs special attention here, to preselect the PIREPS choice of A/C
				  // versus the simple php include('../aircraft.inc'); statement found in the PIREP submit form
				  //include('../aircraft.inc');
				  if ( ($handle = fopen("../aircraft.inc", "r")) == FALSE )
				  	include('../aircraft.inc');
				  else
				  {
				  	while ( !feof($handle) )
					{
				  		// Read each entry
						$sHTML = fgets($handle);

						// stripos available in PHP 5, not 4.x, so make our compares lower case
						$sType = strtolower($pirep["AC_TYPE"]);

						// See if this line of HTML text contains the PIREP aircraft
						$pos = strpos($sHTML, $sType);
						// Spit out HTML if not our A/C
						if ( $pos === false )
							echo $sHTML;
						else
						{
							// Find position of last quote so we can add the HTML attribute selected, to have this A/C selected for us
							$pos = strrpos($sHTML, "\"");
							$sHTML = substr_replace($sHTML, '", selected', $pos+1, 0);
							echo $sHTML;
						}
					}

					// All done
					fclose($handle);
				  }
				  echo '</select>';
				echo '</td>';
			  echo '</tr>';