Jump to content

Need help -- working in IE but not Firefox


melindaSA

Recommended Posts

I am pulling data from a mySQL database into two dropdowns and then submitting the choices from the dropdowns into another table in the database.  This works great in IE but will not work in Firefox.  The submit to the database of the 2nd dropdown is not working.

 

I have attached my code in a txt file.

 

Any help would be greatly appreciated.....

 

Thank you!!!

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/199841-need-help-working-in-ie-but-not-firefox/
Share on other sites

Ths is also not working in IE!  It is not working at all, not submitting to the database!

 

If i look at the page source, the 2nd dropdown is shown.... is the following be the problem?  HELP!!

 

<script language="javascript">
function chkprofile(){
err="";
if(profilefrm.sfname.value=="")
err+="- first name is required.\n";
if(profilefrm.slname.value=="")
err+="- last name is required.\n";
if(profilefrm.sschoolid.value=="")
err+="- school is required.\n";
if(profilefrm.sgradeid.value=="")
err+="- grade is required.\n";
//if(profilefrm.sdob.value=="")
//	err+="- date of birth is required.\n";
if(err!=""){
err='Following are the errors : \n'+err;
alert(err);
return false;
}
return true;
}

function getXMLHTTP() { //fuction to return the xml http object
var xmlhttp=false;
try{
xmlhttp=new XMLHttpRequest();
}
catch(e)	{
try{			
	xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e){
	try{
		req = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e1){
		xmlhttp=false;
	}
}
}
return xmlhttp;
}

function getGrade(schoolid) {
profilefrm.sgradeid.value="";
var strURL="findGrade.php?schoolid="+schoolid;
var req = getXMLHTTP();
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4) {
	// only if "OK"
	if (req.status == 200) {						
		document.getElementById('gradediv').innerHTML=req.responseText;						
	} else {
		alert("There was a problem while using XMLHTTP:\n" + req.statusText);
	}
}				
}			
req.open("GET", strURL, true);
req.send(null);
}
}
</script>

You might want to look into a framework to handle your ajax calls (mootools is my favorite but there are others that are probably just as good) - ajaxy stuff can get very complicated when you're dealing with cross-browser compatibility.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.