hey..am having a doubt that,while using ajax in a page ,am not accesing button value while submiting the details.it is automaticalyy goin to the ajax attached page itself..i need to update the value to the database. can anyone having the reply???

Your problem is a little vague. Perhaps you can explain it with some code?

Hai;

This link will help you , plz check Click Here

i need php code for that..whenever am submiting on button i need to 'update' the value to the database.
view.php

 <tr>
      <th><p>Amount</p></th>
      <td><?php echo $row[6];?></td>
    </tr>

    <tr >
      <th><p>Status</p></th>
      <td><p>



      <div id="poll"> 
  <p><input type="radio" name="col" value="Collected" onClick="getVote(this.value)" >
  Collected</p>
        <p><input type="radio" name="col" id="radio2" value="Postponed" checked="checked"/>
          Postponed</p>
        <p><input type="radio" name="col" id="radio3" value="Rejected" />
        Rejected</p>
     </div>  </p></td>

    </tr>

this is the main page.shownd radio button are attached with ajax.while selecting collected radio button the ajax attached page wil open into the row. code is

<p>Amount:
    <label for="textfield"></label>
  <input type="text" name="textfield" id="textfield">
  </p>
  <p>&nbsp;</p>
  <p>
   <input type="submit" name="button" id="button" value="Change">
  </p>
  <?php

Now..i need to update the textfield value to older amount value by clicking on the update button.and need to replace with the old amount value to the new amunt value in database. can u help me?? thank you in ADVNC

Hai;

Try this,

** in main page **

<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<table>
 <tr>
      <th><p>Amount</p></th>
      <td><?php echo $row[6]=10;?></td>
    </tr>

    <tr >
      <th><p>Status</p></th>
      <td><p>



      <div id="poll"> 
  <p><input type="radio" name="col" value="Collected" class="pole_type">
  Collected</p>
        <p><input type="radio" name="col" id="radio2" value="Postponed" class="pole_type" checked="checked"/>
          Postponed</p>
        <p><input type="radio" name="col" id="radio3" value="Rejected" class="pole_type" />
        Rejected</p>
     </div>  </p></td>

    </tr>
</table>
<script type="text/javascript">
$(function() {
    $(".pole_type").click(function(){
        var val = $(this).val();
        var orderId = "<?php echo $yourOrderId = 1; ?>";
         $.ajax({
            url: "ajaxrequest.php",
            type: "POST",
            data: "poll="+val+"&orderId="+orderId+"&action=editpoll",
            success: function (data) {
                alert(data);
            }
        }); 
    });
});
</script>

In ajaxrequest.php

<?php
switch($_POST['action']) {
    case'editpoll':
        //here you can do your action
        echo "Update your db with OrderId:".$_POST['orderId']." and poll status:".$_POST['poll'];
    break;
}
?>

thank u :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.