Thank you for replying and i used your code, there are no errors however the drop down box has no vaules in them
Code: Select all
<?php
$c = oci_connect('hr', 'hr')
or die('Could not connect to Oracle server');
$stmt = oci_parse($c, 'SELECT flight_number FROM flight_schedules');
oci_execute($stmt, OCI_DEFAULT);
?>
<form action="test2.php" method="post">
<select name="flight_number">
<option value="0"></option>
<?php
while (oci_fetch($stmt)) {
printf('<option value="%1$s">%1$s</option>'
, oci_result($stmt, 'flight_number'));
}
?>
</select>
</form>
maybe i should have shown what i orignally had planned to do
Code: Select all
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
<?php
$stmt = oci_parse($c, 'select flight_number from flight_schedules');
oci_execute($stmt, OCI_DEFAULT);
?>
<select name="flight_number">
<option value="0"></option>
<?php
while (oci_fetch($stmt)) {
printf('<option value="%1$s">%1$s</option>'
, oci_result($stmt, 'flight_number'));
}
?>
</select>
<p>
Flight Number:<br />
<input type="text" name="flight_number" size="30" maxlength="30" value="" />
</p>
<p>
Airline Code:<br />
<input type="text" name="airline_code" size="30" maxlength="30" value="" />
</p>
<p>
Departing From:<br />
<input type="text" name="departing_from" size="30" maxlength="30" value="" />
</p>
<p>
Arriving To:<br />
<input type="text" name="arriving_to" size="30" maxlength="30" value="" />
</p>
<p>
Airport Departing:<br />
<input type="text" name="airport_departing" size="30" maxlength="30" value="" />
</p>
<p>
Terminal Departing:<br />
<input type="text" name="terminal_departing" size="30" maxlength="30" value="" />
</p>
<p>
Airport Arriving:<br />
<input type="text" name="airport_arriving" size="30" maxlength="30" value="" />
</p>
<p>
Terminal Arriving:<br />
<input type="text" name="terminal_arriving" size="30" maxlength="30" value="" />
</p>
<p>
Date Departing:<br />
<input type="text" name="dat_departing" size="30" maxlength="30" value="" />
</p>
<p>
Date Arriving:<br />
<input type="text" name="date_arriving" size="30" maxlength="30" value="" />
</p>
<p>
Time Departing:<br />
<input type="text" name="time_departing" size="30" maxlength="30" value="" />
</p>
<p>
Time Arriving:<br />
<input type="text" name="time_arriving" size="30" maxlength="30" value="" />
</p>
<p>
<input type="submit" name="submit" value="Submit!" />
</p>
<p>
<INPUT TYPE="reset" VALUE="Clear">
</p>
<a href = "test.html"> Menu</a>
</form>
What i wanted was to replace all or most of the textboxes with drop down boxes and the query would be displayed by this other php file
Code: Select all
<?php
if (isset($_POST['submit']))
{
$c = @oci_connect('hr', 'hr')
or die("Could not connect to Oracle server");
$flight__number = $_POST['flight_number'];
$airline_code = $_POST['airline_code'];
$departing_from = $_POST['departing_from'];
$arriving_to = $_POST['arriving_to'];
$airport_departing = $_POST['airport_departing'];
$terminal_departing = $_POST['terminal_departing'];
$airport_arriving = $_POST['airport_arriving'];
$terminal_arriving = $_POST['terminal_arriving'];
$date_departing = $_POST['date_departing'];
$date_arriving = $_POST['date_arriving'];
$time_departing = $_POST['time_departing'];
$time_arriving = $_POST['time_arriving'];
$s = oci_parse($c, "INSERT INTO flight_schedules(flight_number, airline_code, departing_from,
arriving_to, airport_departing, terminal_departing, airport_arriving, terminal_arriving,
date_departing, date_arriving, time_departing, time_arriving)
vALUES('$flight_number', '$airline_code','$departing_from', '$arriving_to',
'$airport_departing', '$terminal_departing','$airport_arriving', '$terminal_arriving',
'$date_departing', '$date_arriving','$time_departing', '$time_arriving',)");
$result = oci_execute($s);
if ($result)
{
echo "<p>A New Airline has been inserted</p>";
oci_commit($c);
}
else
{
echo "<p>There was a problem inserting a New Airline!</p>";
var_dump(oci_error($s));
}
oci_close($c);
}
include "insert_flight_schedules.php";
include "flight_schedules_query.php";
?>