<script src="./jquery.js"></script>
<script src="./ui/jquery.ui.widget.js"></script>
<script src="./ui/jquery.ui.button.js"></script>
<script src="./ui/jquery.ui.core.js"></script>
<script src="./ui/jquery.ui.widget.js"></script>
<script src="./ui/jquery.ui.mouse.js"></script>
<script src="./ui/jquery.ui.button.js"></script>
<script src="./ui/jquery.ui.draggable.js"></script>
<script src="./ui/jquery.ui.position.js"></script>
<script src="./ui/jquery.ui.resizable.js"></script>
<script src="./ui/jquery.ui.dialog.js"></script>
<script src="./ui/jquery.ui.effect.js"></script>
<?php
require_once ('config.php');
$icao = $_REQUEST["icao"];
$query = "SELECT * FROM aircrafts WHERE ICAO = '$icao'";
if (!$result)
{
}
?>
<form method="post" action="editar-ruta.php">
<?php
echo '<table border="0">';
echo '<tr><td class="forms">ICAO:</td><td><input type="text" name="icao" size="30" value=';
echo $row["ICAO"] . "></td></tr>";
echo '<tr><td class="forms">Name:</td><td><input type="text" name="name" size="30" value=';
echo $row["Name"] . "></td></tr>";
echo '<tr><td class="forms">Weight Empty:</td><td><input type="text" name="weightempty" size="30" value=';
echo $row["WeightEmpty"] . "></td></tr>";
echo '<tr><td class="forms">Weight Full:</td><td><input type="text" name="weightfull" size="30" value=';
echo $row["WeightFull"] . "></td></tr>";
echo '<tr><td class="forms">Cargo Full:</td><td><input type="text" name="cargofull" size="30" value=';
echo $row["CargoFull"] . "></td></tr>";
echo '<tr><td class="forms">Cruise Speed:</td><td><input type="text" name="cruisespeed" size="30" value=';
echo $row["CruiseSpeed"] . "></td></tr>";
echo '<tr><td class="forms">Range:</td><td><input type="text" name="range" size="30" value=';
echo $row["Range"] . "></td></tr>";
echo '<tr><td class="forms">Price:</td><td><input type="text" name="price" size="30" value=';
echo $row["Price"] . "></td></tr>";
echo '<tr><td class="forms">Number Classes:</td><td><select id="numberclasses" name="numberclasses">';
echo "<option value='0'>Select Number of Classes</option>";
echo "<option value='1'>One Classes (Economy)</option>";
echo "<option value='2'>Two Classes (Business & Economy)</option>";
echo "<option value='3'>Three Classes (First, Business & Economy)</option>";
echo '</select></td></tr>';
if($row["FirstClassSeats"] == NULL || $row["FirstClassSeats"] == 0){$disabled1 = "disabled='disabled'";}
echo '<tr><td class="forms">First Class Seats:</td><td><input '.$disabled1.' type="text" id="firstclassseats" name="firstclassseats" size="30" value=';
echo $row["FirstClassSeats"] . "></td></tr>";
if($row["BusinessClassSeats"] == NULL || $row["BusinessClassSeats"] == 0){$disabled2 = "disabled='disabled'";}
echo '<tr><td class="forms">Business Class Seats:</td><td><input '.$disabled2.' type="text" id="businessclassseats" name="businessclassseats" size="30" value=';
echo $row["BusinessClassSeats"] . "></td></tr>";
if($row["EconomyClassSeats"] == NULL || $row["EconomyClassSeats"] == 0){$disabled3 = "disabled='disabled'";}
echo '<tr><td class="forms">Economy Class Seats:</td><td><input '.$disabled3.' type="text" id="economyclassseats" name="economyclassseats" size="30" value=';
echo $row["EconomyClassSeats"] . "></td></tr>";
?>
<script type="text/javascript">
$(document).ready(function() {
$("#editaircraft").click(function(event) {
event.preventDefault(); // si envías con ajax desde un botón submit
alert('enviar x ajax');
});
$("#numberclasses").change(function() {
value = $(this).val();
str = parseInt(value);
switch(str){
case 0:
$("#firstclassseats").attr("disabled","disabled");
$("#businessclassseats").attr("disabled","disabled");
$("#economyclassseats").attr("disabled","disabled");
break;
case 1:
$("#economyclassseats").removeAttr('disabled');
$("#firstclassseats").attr("disabled","disabled");
$("#businessclassseats").attr("disabled","disabled");
break;
case 2:
$("#businessclassseats").removeAttr('disabled');
$("#economyclassseats").removeAttr('disabled');
$("#firstclassseats").attr("disabled","disabled");
break;
case 3:
$("#firstclassseats").removeAttr('disabled');
$("#businessclassseats").removeAttr('disabled');
$("#economyclassseats").removeAttr('disabled');
break;
}
});
});
</script>
<?php
echo "<tr><td><input id='editaircraft' type='submit' value='Edit Aircraft'></td></tr>";
}
echo "</table>";
?>
</form>