Advertisement

09.19.2008 at 01:35PM PDT, ID: 23747308
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.4

Works in IE but not in Firefox to get the values using Ajax

Asked by syedasimmeesaq in PHP and Databases, PHP Scripting Language, Asynchronous Javascript and XML (AJAX)

I am trying get the values for the textfields using php any ajax and once I enter the value when I go back to the page the values are called back from the database and shows in the form. I can see the values in IE but I can not see it in Firefox. How come?Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
<?php 
session_start();
require_once("connect_info.php"); 
    if ((isset($_GET['T'])) || (isset($_GET['S'])) || (isset($_GET['N'])) || (isset($_GET['O'])) || (isset($_GET['E'])) ||(isset($_GET['Nu'])))
	
	{
	$myres = "update classsurvey set Teacher = '".$_GET['T']."', Starttime = '".$_GET['S']."', NumberofAdults = '".$_GET['N']."', Observer = '".$_GET['O']."', Endtime = '".$_GET['E']."', NumberofChildren = '".$_GET['Nu']."' where ID=1";
 
 $inrec = mysql_query($myres);
 
 
	}        
	
 
 
include_once('upper.php'); ?>
<script language="javascript" type="text/javascript">
<!-- 
//Browser Support Code
function ajaxFunction(){
        
        var ajaxRequest;  // The variable that makes Ajax possible!
        
        try{
                // Opera 8.0+, Firefox, Safari
                ajaxRequest = new XMLHttpRequest();
        } catch (e){
                // Internet Explorer Browsers
                try{
                        ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
                } catch (e) {
                        try{
                                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
                        } catch (e){
                                // Something went wrong
                                alert("Please update your browser!");
                                return false;
                        }
                }
        }
                                // Create a function that will receive data sent from the server
                                ajaxRequest.onreadystatechange = function(){
                                if(ajaxRequest.readyState == 4){
                                
                                
                                document.getElementById("comments").innerHTML = ajaxRequest.responseText;
                                
                                }
                        }
                        var url="mainsurvey.php?T=" + encodeURIComponent(document.getElementById('T').value) + "&S="+encodeURIComponent(document.getElementById('S').value) + "&N="+encodeURIComponent(document.getElementById('N').value) + "&O="+encodeURIComponent(document.getElementById('O').value)+ "&E="+encodeURIComponent(document.getElementById('E').value)+ "&Nu="+encodeURIComponent(document.getElementById('Nu').value);
                        ajaxRequest.open("GET", url, true);
                        ajaxRequest.send(null); 
 
        
        
}
//-->
</script>
 
</body>
</html>
 
<style type="text/css">
<!--
.style1 {
	font-size: xx-small;
	font-weight: bold;
	color: #FF0000;
}
-->
</style>			
 
<?php require('myfunctions.php'); 
require_once("connect_info.php");
$gvalues = mysql_query("select * from table where user = '".mysql_real_escape_string($_SESSION["user"])."'") or die ("Update error: ".mysql_error());
$row = mysql_fetch_assoc($gvalues); 
?>
<form action="" method="POST">
			
<div style="background:#3F3F3F; color:#FFFFFF; border:dashed 1px; margin-left: 10%; margin-right:10%; margin-top: 0%; font-size:x-large;" align="center">
OBSERVATION SHEET </div> 
<div id="clearboth"><br>
</div>
            
    <div style="width:100%; margin-left:10% " align="center" >
    <div style="width:40%; float:left; clear:left">
    <table width="90%">
  <tr>
    <td>Teacher: <?php echo "1".$row["T"]; ?></td>
    <td><input name="T" type="text" id="Teacher" value="<?php echo $row["T"]; ?>" onChange="ajaxFunction();"  /></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>Start time</td>
    <td><input name="S" type="text" id="S" value="<?php echo $row["S"]; ?>" onChange="ajaxFunction();"></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>Number of adults</td>
    <td><input name="N" type="text" id="N" value="<?php echo $row["N"]; ?>" onChange="ajaxFunction();"></td>
    <td>&nbsp;</td>
  </tr>
</table>
</div>
<div style="width:40%; float:left; clear:inherit;">
<table width="90%">
  <tr>
    <td>Observer</td>
    <td><input name="O" type="text" id="O" value="<?php echo $row["O"]; ?>" onChange="ajaxFunction();"></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>End time</td>
    <td><input name="E" type="text" id="E"  value="<?php echo $row["E"]; ?>" onChange="ajaxFunction();"></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>Number of Children</td>
    <td><input name="Nu" type="text" id="Nu"  value="<?php echo $row["Nu"]; ?>" onChange="ajaxFunction();"></td>
    <td>&nbsp;</td>
  </tr>
</table>
</div>
</div>
 
 
    
    
    
    
    </form>        
            
            
            
          <?php include_once('lower.php'); ?>
 
Loading Advertisement...
 
[+][-]09.19.2008 at 01:56PM PDT, ID: 22525475

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: PHP and Databases, PHP Scripting Language, Asynchronous Javascript and XML (AJAX)
Sign Up Now!
Solution Provided By: syedasimmeesaq
Participating Experts: 0
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628