I have a web based form that contains a select box that calls to an AJAX function from the onchange event that produces at least two additional select/textboxes boxes. When I submit the form using Firefox/Mozilla, the additional form values do not post to the next page. Ugh! Works fine in IE. Below is a copy of the selectTimeSettings.js that the first select box calls.

var xmlHttp
function ShowTimeSettings(str){
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null) {
alert ("Browser does not support HTTP Request")
return
}
var url="select_time_settings.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChanged() {
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
document.getElementById("txtHint").innerHTML=xmlHttp.responseText
}
}
function GetXmlHttpObject() {
var xmlHttp=null;
try {
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e) {
//Internet Explorer
try {
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}

tia,
SavyCat:)

You have put semicolons at the end of each statement in GetXmlHttpObject() function but not in stateChanged() and ShowTimeSettings() functions. Be consistent in your coding style.

And please use code tags to put your code.

//----------------------------------------------------------------------------
//--- add_flight.php ----------------------------------------------------------
//----------------------------------------------------------------------------

<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Add Flight</title>
<script type="text/javascript" src='selectTimeSettings.js'></script>
</head>
<body>

<?php

echo "<table border='0' cellpadding='0' cellspacing='0'><tr>";

echo "<form action='add_flight.php' method='post' name='addlog'>";

echo "<input type='hidden' name='atd' value='1'>";

echo "<td class='select'><select name='aircraft' onChange='javascript:showTimeSettings(this.value);'><option value='ac'>Select an Aircraft</option><option value='1'>N123AV</option>etc.";

More form inputs here.

echo "<td><div id='txtHint'><font class='tfont'><b>Select an Aircraft to retrieve time settings.<div></td>";

//----------------------------------------------------------------------------
//--- End --------------------------------------------------------------------
//----------------------------------------------------------------------------
//--- selectTimeSettings.js ---------------------------------------------------
//----------------------------------------------------------------------------

var xmlHttp;
function showTimeSettings(str){
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
alert ("Browser does not support HTTP Request");
return;
}
var url="selectTimeSettings.php";
url=url+"?q="+str;
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function stateChanged() {
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
}
}
function GetXmlHttpObject() {
var xmlHttp=null;
try {
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e) {
//Internet Explorer
try {
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}

//----------------------------------------------------------------------------
//--- End --------------------------------------------------------------------
//----------------------------------------------------------------------------
//--- selectTimeSettings.php -------------------------------------------------
//----------------------------------------------------------------------------

<?php

$q=$_GET["q"];

ob_start();
session_start();
error_reporting(0);
include("config.php");
include("functions.php");

$cy = date("Y");

$connection = mysql_connect($hostname, $user, $pass) or die ("Unable to connect!");

$query = "select tz_pref from av.pilot_info where uid='$SESSION_UID'";
$result = mysql_db_query($database, $query, $connection) or die ("Error in query: $query. " . mysql_error());

$tz_pref=mysql_result($result,$i,"tz_pref");

if ($tz_pref == "0") { $dtz = "Greenwich Mean Time (Zulu)"; }
else if ($tz_pref == "-3.5") { $dtz = "Newfoundland Time"; }
else if ($tz_pref == "-4") { $dtz = "Atlantic Time"; }
else if ($tz_pref == "-5") { $dtz = "Eastern Time"; }
else if ($tz_pref == "-6") { $dtz = "Central Time"; }
else if ($tz_pref == "-7") { $dtz = "Mountain Time"; }
else if ($tz_pref == "-8") { $dtz = "Pacific Time"; }
else if ($tz_pref == "-9") { $dtz = "Alaska Time"; }
else if ($tz_pref == "-10") { $dtz = "Hawaii-Aleutian Time"; }

$query = "select mc, adesc, hobbs_in, time_setting from av.pilot_ac left join av.logbook on pilot_ac.aid=logbook.aid where pilot_ac.aid='".$q."' order by flight_date desc, lb_id desc limit 1";
$result = mysql_db_query($database, $query, $connection) or die ("Error in query: $query. " . mysql_error());

$mc=mysql_result($result,$i,"mc");
$adesc_sel=mysql_result($result,$i,"adesc");
$hobbs_out=mysql_result($result,$i,"hobbs_in");
$time_setting=mysql_result($result,$i,"time_setting");

if ($hobbs_out == 0.0) { $hobbs_out=""; }

if ($adesc_sel == 4 || $adesc_sel == 7 || $adesc_sel == 9) {

echo "<td align='center' style='padding-bottom:10px'><table border='0' cellpadding='0' cellspacing='0'><tr>";

echo "<td align='left' colspan='2'><font class='tfont'><b>All SIM's, FTD's and PCATD's only<br>require Total Flight Time.</b></font></td>";

echo "</tr><tr>";

echo "<td align='center' style='padding-top:10px'><table border='0' cellpadding='0' cellspacing='0'><tr>";

echo "<td align='right' style='padding-right:5px;'><font class='tfont'>Total Flight Time: </td>";
echo "<td style='padding-top:5px'><table cellpadding='0' cellspacing='0'></tr>";
echo "<td class='select'><select name='eflight_time' style='width:50px'><option value='select'></option>";
$x=1;
while ($x < 81) {
$y = $x / 10;
if ($y == 1 || $y == 2 || $y == 3 || $y == 4 || $y == 5 || $y == 6 || $y == 7 || $y == 8) {
$y = $y.".0";
}
echo "<option value='$y'>$y</option>";
++$x;
}
echo "</select></td>";
echo "</tr></table></td>";

echo "</tr><tr>";

echo "<td colspan='2' style='padding-top:5px'><table cellpadding='0' cellspacing='0'></tr>";

echo "<td align='right' style='padding-right:5px;'><font class='tfont'>Instrument Time:</td>";
echo "<td class='select'><select name='instr_ft' style='width:50px'><option></option>";
$x=1;
while ($x < 81) {
$y = $x / 10;
if ($y == 1 || $y == 2 || $y == 3 || $y == 4 || $y == 5 || $y == 6 || $y == 7 || $y == 8) {
$y = $y.".0";
}
echo "<option value='$y'>$y</option>";
++$x;
}
echo "</select></td>";
echo "</tr></table></td></tr></table></td>";

}
else {

echo "</tr><tr>";

echo "<td align='center'><table border='0' cellpadding='0' cellspacing='0'><tr>";

//--- Time Out/In Time Option -----------------------------------------------

if ($time_setting == 4) {

echo "</tr><tr>";

echo "<td align='left' style='padding-bottom:5px'><font class='tfont'><b>As per your Time Zone preference, please<br>enter all times in $dtz.</b></font></td>";

echo "</tr><tr>";

echo "<td><table cellpadding='0' cellspacing='2'></tr>";
echo "<td align='right' style='padding-right:5px;'><font class='tfont'>Time Out:</td>";
echo "<td class='select'><select name='tohr' style='width:45px'><option value='hr'>Hr</option>";
$x=0;
while ($x < 24) {
if ($x < 10) { $x = "0".$x; }
if ($fot_arr[0] == $x && $fot_arr[0] != "fred") {
echo "<option value='$x' selected>$x</option>";
}
else {
echo "<option value='$x'>$x</option>";
}
++$x;
}
echo "</select></td>";
echo "<td class='select'><select name='tomin' style='width:45px'><option value='00'>00</option>";
$y=1;
while ($y < 60) {
if ($y < 10) { $y = "0".$y; }
if ($fto_arr[1] == $y && $fto_arr[1] != "fred") {
echo "<option value='$y' selected>$y</option>";
}
else {
echo "<option value='$y'>$y</option>";
}
++$y;
}
echo "</select></td>";
echo "<td align='right' style='padding-left:10px; padding-right:5px;'><font class='tfont'>Time In:</td>";
echo "<td class='select'><select name='tihr' style='width:45px'><option value='hr'>Hr</option>";
$x=0;
while ($x < 24) {
if ($x < 10) { $x = "0".$x; }
if ($fit_arr[0] == $x && $fit_arr[0] != "fred") {
echo "<option value='$x' selected>$x</option>";
}
else {
echo "<option value='$x'>$x</option>";
}
++$x;
}
echo "</select></td>";
echo "<td class='select'><select name='timin' style='width:45px'><option value='00'>00</option>";
$y=1;
while ($y < 60) {
if ($y < 10) { $y = "0".$y; }
if ($fti_arr[1] == $y && $fti_arr[1] != "fred") {
echo "<option value='$y' selected>$y</option>";
}
else {
echo "<option value='$y'>$y</option>";
}
++$y;
}
echo "</select></td>";
echo "</tr><tr>";
echo "<td align='right' colspan='5' style='padding-right:5px;'><font class='tfont'>Instrument Time:</td>";
echo "<td class='select'><select name='instr_ft' style='width:45px'><option></option>";
$x=1;
while ($x < 81) {
$y = $x / 10;
if ($y == 1 || $y == 2 || $y == 3 || $y == 4 || $y == 5 || $y == 6 || $y == 7 || $y == 8) {
$y = $y.".0";
}
echo "<option value='$y'>$y</option>";
++$x;
}
echo "</select></td>";
echo "</tr></table></td>";
}

//--- Hobbs Time Option ------------------------------------------------------

else if ($time_setting == 3) {

echo "</tr><tr>";

echo "<td align='right' style='padding-left:50px; padding-top:5px'><table cellpadding='0' cellspacing='2'><tr>";

echo "<td align='right' style='padding-right:5px;'><font class='tfont'>Hobbs Out: </td>";
echo "<td class='iwborder' height='25'><input class='textc2' type='text' style='width:50px' name='hobbs_out' value='$hobbs_out'></td>";
echo "<td align='right' style='padding-left:5px; padding-right:5px;'><font class='tfont'>Hobbs In: </td>";
echo "<td class='iwborder' height='25'><input class='textc2' type='text' style='width:50px' name='hobbs_in' value='$hobbs_in'></td>";
echo "</tr><tr>";
echo "<td align='right' colspan='3' style='padding-right:5px;'><font class='tfont'>Instrument Time:</td>";
echo "<td class='select'><select name='instr_ft' style='width:50px'><option></option>";
$x=1;
while ($x < 81) {
$y = $x / 10;
if ($y == 1 || $y == 2 || $y == 3 || $y == 4 || $y == 5 || $y == 6 || $y == 7 || $y == 8) {
$y = $y.".0";
}
echo "<option value='$y'>$y</option>";
++$x;
}
echo "</select></td>";
echo "</tr></table></td>";
}

else if ($time_setting == 2) {

echo "</tr><tr>";

echo "<td align='right' style='padding-left:100px; padding-right:5px;'><font class='tfont'>Total Flight Time: </td>";
echo "<td class='select'><select name='eflight_time' style='width:50px'><option value='select'></option>";
$x=1;
while ($x < 81) {
$y = $x / 10;
if ($y == 1 || $y == 2 || $y == 3 || $y == 4 || $y == 5 || $y == 6 || $y == 7 || $y == 8) {
$y = $y.".0";
}
echo "<option value='$y'>$y</option>";
++$x;
}
echo "</select></td>";

echo "</tr><tr>";

echo "<td align='right' style='padding-left:100px; padding-right:5px;'><font class='tfont'>Instrument Time:</td>";
echo "<td class='select'><select name='instr_ft' style='width:50px'><option></option>";
$x=1;
while ($x < 81) {
$y = $x / 10;
if ($y == 1 || $y == 2 || $y == 3 || $y == 4 || $y == 5 || $y == 6 || $y == 7 || $y == 8) {
$y = $y.".0";
}
echo "<option value='$y'>$y</option>";
++$x;
}
echo "</select></td>";

echo "</tr></table></td></tr></table></td>";
}
echo "</tr></table></td>";
}

mysql_close($connection);

?>

I counted numerous quotation errors in your selectTimeSettings.php

<?php

$q=$_GET["q"];

ob_start();
session_start();
error_reporting(0);
include("config.php");
include("functions.php");

$cy = date("Y");

$connection = mysql_connect($hostname, $user, $pass) or die ("Unable to connect!");

$query = "select tz_pref from av.pilot_info where uid='".$SESSION_UID."'";
$result = mysql_db_query($database, $query, $connection) or die ("Error in query: ".$query." mysql_error()");

$tz_pref=mysql_result($result,$i,"tz_pref");

if ($tz_pref == "0") { $dtz = "Greenwich Mean Time (Zulu)"; }
else if ($tz_pref == "-3.5") { $dtz = "Newfoundland Time"; }
else if ($tz_pref == "-4") { $dtz = "Atlantic Time"; }
else if ($tz_pref == "-5") { $dtz = "Eastern Time"; }
else if ($tz_pref == "-6") { $dtz = "Central Time"; }
else if ($tz_pref == "-7") { $dtz = "Mountain Time"; }
else if ($tz_pref == "-8") { $dtz = "Pacific Time"; }
else if ($tz_pref == "-9") { $dtz = "Alaska Time"; }
else if ($tz_pref == "-10") { $dtz = "Hawaii-Aleutian Time"; }

$query = "select mc, adesc, hobbs_in, time_setting from av.pilot_ac left join av.logbook on pilot_ac.aid=logbook.aid where pilot_ac.aid='".$q."' order by flight_date desc, lb_id desc limit 1";
$result = mysql_db_query($database, $query, $connection) or die ("Error in query: ".$query. "mysql_error()");

$mc=mysql_result($result,$i,"mc");
$adesc_sel=mysql_result($result,$i,"adesc");
$hobbs_out=mysql_result($result,$i,"hobbs_in");
$time_setting=mysql_result($result,$i,"time_setting");

if ($hobbs_out == 0.0) { $hobbs_out=""; }

if ($adesc_sel == 4 || $adesc_sel == 7 || $adesc_sel == 9) {

echo "<td align='center' style='padding-bottom:10px'><table border='0' cellpadding='0' cellspacing='0'><tr>";

echo "<td align='left' colspan='2'><font class='tfont'><b>All SIM's, FTD's and PCATD's only<br>require Total Flight Time.</b></font></td>";

echo "</tr><tr>";

echo "<td align='center' style='padding-top:10px'><table border='0' cellpadding='0' cellspacing='0'><tr>";

echo "<td align='right' style='padding-right:5px;'><font class='tfont'>Total Flight Time: </td>";
echo "<td style='padding-top:5px'><table cellpadding='0' cellspacing='0'></tr>";
echo "<td class='select'><select name='eflight_time' style='width:50px'><option value='select'></option>";
$x=1;
while ($x < 81) {
$y = $x / 10;
if ($y == 1 || $y == 2 || $y == 3 || $y == 4 || $y == 5 || $y == 6 || $y == 7 || $y == 8) {
$y = $y.".0";
}
echo "<option value='$y'>$y</option>";
++$x;
}
echo "</select></td>";
echo "</tr></table></td>";

echo "</tr><tr>";

echo "<td colspan='2' style='padding-top:5px'><table cellpadding='0' cellspacing='0'></tr>";

echo "<td align='right' style='padding-right:5px;'><font class='tfont'>Instrument Time:</td>";
echo "<td class='select'><select name='instr_ft' style='width:50px'><option></option>";
$x=1;
while ($x < 81) {
$y = $x / 10;
if ($y == 1 || $y == 2 || $y == 3 || $y == 4 || $y == 5 || $y == 6 || $y == 7 || $y == 8) {
$y = $y.".0";
}
echo "<option value='".$y."'>".$y."</option>";
++$x;
}
echo "</select></td>";
echo "</tr></table></td></tr></table></td>";

}
else {

echo "</tr><tr>";

echo "<td align='center'><table border='0' cellpadding='0' cellspacing='0'><tr>";

//--- Time Out/In Time Option -----------------------------------------------

if ($time_setting == 4) {

echo "</tr><tr>";

echo "<td align='left' style='padding-bottom:5px'><font class='tfont'><b>As per your Time Zone preference, please<br>enter all times in ".$dtz."</b></font></td>";

echo "</tr><tr>";

echo "<td><table cellpadding='0' cellspacing='2'></tr>";
echo "<td align='right' style='padding-right:5px;'><font class='tfont'>Time Out:</td>";
echo "<td class='select'><select name='tohr' style='width:45px'><option value='hr'>Hr</option>";
$x=0;
while ($x < 24) {
if ($x < 10) { $x = "0".$x; }
if ($fot_arr[0] == $x && $fot_arr[0] != "fred") {
echo "<option value='".$x."' selected>".$x."</option>";
}
else {
echo "<option value='".$x."'>".$x."</option>";
}
++$x;
}
echo "</select></td>";
echo "<td class='select'><select name='tomin' style='width:45px'><option value='00'>00</option>";
$y=1;
while ($y < 60) {
if ($y < 10) { $y = "0".$y; }
if ($fto_arr[1] == $y && $fto_arr[1] != "fred") {
echo "<option value='".$y."' selected>".$y."</option>";
}
else {
echo "<option value='".$y."'>".$y."</option>";
}
++$y;
}
echo "</select></td>";
echo "<td align='right' style='padding-left:10px; padding-right:5px;'><font class='tfont'>Time In:</td>";
echo "<td class='select'><select name='tihr' style='width:45px'><option value='hr'>Hr</option>";
$x=0;
while ($x < 24) {
if ($x < 10) { $x = "0".$x; }
if ($fit_arr[0] == $x && $fit_arr[0] != "fred") {
echo "<option value='".$x."' selected>".$x."</option>";
}
else {
echo "<option value='".$x."'>".$x."</option>";
}
++$x;
}
echo "</select></td>";
echo "<td class='select'><select name='timin' style='width:45px'><option value='00'>00</option>";
$y=1;
while ($y < 60) {
if ($y < 10) { $y = "0".$y; }
if ($fti_arr[1] == $y && $fti_arr[1] != "fred") {
echo "<option value='".$y."' selected>".$y."</option>";
}
else {
echo "<option value='".$y."'>".$y."</option>";
}
++$y;
}
echo "</select></td>";
echo "</tr><tr>";
echo "<td align='right' colspan='5' style='padding-right:5px;'><font class='tfont'>Instrument Time:</td>";
echo "<td class='select'><select name='instr_ft' style='width:45px'><option></option>";
$x=1;
while ($x < 81) {
$y = $x / 10;
if ($y == 1 || $y == 2 || $y == 3 || $y == 4 || $y == 5 || $y == 6 || $y == 7 || $y == 8) {
$y = $y.".0";
}
echo "<option value='".$y."'>".$y."</option>";
++$x;
}
echo "</select></td>";
echo "</tr></table></td>";
}

//--- Hobbs Time Option ------------------------------------------------------

else if ($time_setting == 3) {

echo "</tr><tr>";

echo "<td align='right' style='padding-left:50px; padding-top:5px'><table cellpadding='0' cellspacing='2'><tr>";

echo "<td align='right' style='padding-right:5px;'><font class='tfont'>Hobbs Out: </td>";
echo "<td class='iwborder' height='25'><input class='textc2' type='text' style='width:50px' name='hobbs_out' value='".$hobbs_out."'></td>";
echo "<td align='right' style='padding-left:5px; padding-right:5px;'><font class='tfont'>Hobbs In: </td>";
echo "<td class='iwborder' height='25'><input class='textc2' type='text' style='width:50px' name='hobbs_in' value='".$hobbs_in."'></td>";
echo "</tr><tr>";
echo "<td align='right' colspan='3' style='padding-right:5px;'><font class='tfont'>Instrument Time:</td>";
echo "<td class='select'><select name='instr_ft' style='width:50px'><option></option>";
$x=1;
while ($x < 81) {
$y = $x / 10;
if ($y == 1 || $y == 2 || $y == 3 || $y == 4 || $y == 5 || $y == 6 || $y == 7 || $y == 8) {
$y = $y.".0";
}
echo "<option value='".$y."'>".$y."</option>";
++$x;
}
echo "</select></td>";
echo "</tr></table></td>";
}

else if ($time_setting == 2) {

echo "</tr><tr>";

echo "<td align='right' style='padding-left:100px; padding-right:5px;'><font class='tfont'>Total Flight Time: </td>";
echo "<td class='select'><select name='eflight_time' style='width:50px'><option value='select'></option>";
$x=1;
while ($x < 81) {
$y = $x / 10;
if ($y == 1 || $y == 2 || $y == 3 || $y == 4 || $y == 5 || $y == 6 || $y == 7 || $y == 8) {
$y = $y.".0";
}
echo "<option value='".$y."'>".$y."</option>";
++$x;
}
echo "</select></td>";

echo "</tr><tr>";

echo "<td align='right' style='padding-left:100px; padding-right:5px;'><font class='tfont'>Instrument Time:</td>";
echo "<td class='select'><select name='instr_ft' style='width:50px'><option></option>";
$x=1;
while ($x < 81) {
$y = $x / 10;
if ($y == 1 || $y == 2 || $y == 3 || $y == 4 || $y == 5 || $y == 6 || $y == 7 || $y == 8) {
$y = $y.".0";
}
echo "<option value='".$y."'>".$y."</option>";
++$x;
}
echo "</select></td>";

echo "</tr></table></td></tr></table></td>";
}
echo "</tr></table></td>";
}

mysql_close($connection);

?>

I don't have the chance to look at your problem further, maybe that helps : - )

This article has been dead for over six months. Start a new discussion instead.