$target = "detail_pax.php?alias={$alias}&pilot={$rvar_pilot}"; header("Location: {$target}"); exit; } include "include/head.inc"; ?> <form method="get" action="edit_pax.php"> <div id="logbook"> <table> <?php if ($rvar_id != 0) { $sql = "SELECT * FROM passengers WHERE id = {$rvar_id}"; $sqlresponse = lol_query($sql); $line = lol_fetch_array($sqlresponse); } ?> <tr> <th>Alias</th> <th>Name</th> </tr> <tr> <td><strong><?php print $line['alias']; ?> </strong></td> <td width="100%"><input type="text" name="fullname" size="40" value="<?php print $line['fullname'];
$rvar_instrument_approach = sprintf("%0d", $rvar_instrument_approach); $rvar_conditions_night = sprintf("%02.2f", $rvar_conditions_night); $rvar_conditions_actualinstr = sprintf("%02.2f", $rvar_conditions_actualinstr); $rvar_conditions_simulinstr = sprintf("%02.2f", $rvar_conditions_simulinstr); $rvar_type_xc = sprintf("%02.2f", $rvar_type_xc); $rvar_type_cfi = sprintf("%02.2f", $rvar_type_cfi); $rvar_type_dual = sprintf("%02.2f", $rvar_type_dual); $rvar_type_pic = sprintf("%02.2f", $rvar_type_pic); $rvar_type_sic = sprintf("%02.2f", $rvar_type_sic); $rvar_cost = sprintf("%04.2f", $rvar_cost); if ($rvar_id == 0) { # new logbiook entry $sql = "INSERT INTO logbook (\n pilot_id, date, ident, passengers,\n launch_type, alt_release, alt_maximum,\n remarks, landings_day, landings_night, instrument_approach,\n conditions_night,\n conditions_actualinstr, conditions_simulinstr,\n type_xc, type_cfi, type_dual, type_pic, type_sic,\n detail, url, cost\n ) VALUES " . "({$rvar_pilot},'{$rvar_date}','{$rvar_ident}','{$rvar_passengers}'," . "'{$rvar_launch_type}',{$rvar_alt_release},{$rvar_alt_maximum}," . "'{$rvar_remarks}',{$rvar_landings_day},{$rvar_landings_night},{$rvar_instrument_approach}," . "{$rvar_conditions_night}," . "{$rvar_conditions_actualinstr},{$rvar_conditions_simulinstr}," . "{$rvar_type_xc},{$rvar_type_cfi},{$rvar_type_dual},{$rvar_type_pic},{$rvar_type_sic}," . "'{$rvar_detail}','{$rvar_url}',{$rvar_cost})"; $sql_response = lol_query($sql); // fetch the id of the logbook entry we just added $entry = lol_fetch_array(lol_query("SELECT id FROM logbook WHERE pilot_id = {$rvar_pilot} ORDER BY id DESC")); $hops = preg_split("/ +/", $rvar_route, -1, PREG_SPLIT_NO_EMPTY); for ($i = 0; $i < sizeof($hops); $i++) { lol_query("INSERT INTO flight_route (logbook_id, airport, sequence) VALUES ({$entry['id']}, '{$hops[$i]}', {$i})"); } } else { # editing an old entry $sql = "UPDATE logbook SET " . "date='{$rvar_date}', ident='{$rvar_ident}', passengers='{$rvar_passengers}', " . "launch_type='{$rvar_launch_type}', alt_release={$rvar_alt_release}, alt_maximum={$rvar_alt_maximum}, " . "remarks='{$rvar_remarks}', landings_day={$rvar_landings_day}, landings_night={$rvar_landings_night}, " . "instrument_approach={$rvar_instrument_approach}, " . "conditions_night={$rvar_conditions_night}, " . "conditions_actualinstr={$rvar_conditions_actualinstr}, conditions_simulinstr={$rvar_conditions_simulinstr}, " . "type_xc={$rvar_type_xc}, type_cfi={$rvar_type_cfi}, type_dual={$rvar_type_dual}, type_pic={$rvar_type_pic}, " . "type_sic={$rvar_type_sic}, detail='{$rvar_detail}', url='{$rvar_url}', cost={$rvar_cost} WHERE id = {$rvar_id}"; $sql_response = lol_query($sql); lol_query("DELETE FROM flight_route WHERE logbook_id = {$rvar_id}"); $hops = preg_split("/ +/", $rvar_route, -1, PREG_SPLIT_NO_EMPTY); for ($i = 0; $i < sizeof($hops); $i++) { lol_query("INSERT INTO flight_route (logbook_id, airport, sequence) VALUES ({$rvar_id}, '{$hops[$i]}', {$i})"); } } if ($rvar_id > 0) {