Results 1 to 4 of 4

Thread: getting values from ajax

  1. #1
    Join Date
    Aug 2009
    Posts
    74
    Thanks
    7
    Thanked 1 Time in 1 Post

    Default getting values from ajax

    iam getting values from ajax how to store them in variables according to my 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").v alue+"& 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.

  2. #2
    Join Date
    Mar 2007
    Location
    New York, NY
    Posts
    557
    Thanks
    8
    Thanked 66 Times in 66 Posts

    Default

    But you need to post code for scheduleexist.php. Does it even exist or need to be written from scratch? Also, how are you storing this data?
    - Josh

  3. #3
    Join Date
    Aug 2009
    Posts
    74
    Thanks
    7
    Thanked 1 Time in 1 Post

    Default

    <?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==0 || $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();


    ?>

  4. #4
    Join Date
    Mar 2007
    Location
    New York, NY
    Posts
    557
    Thanks
    8
    Thanked 66 Times in 66 Posts

    Default

    What is the script for getContent(); ? If I post one version of the code, it'll be different from your javascript.
    - Josh

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •