this code doesnt save data in db as 1 when i click on yes button..

      <table id="main" class="display" cellspacing="0" width="100%"> <thead> <tr> <th>Date</th> <th>Amount</th> <th>Approve</th> </tr> </thead> <tbody> <?php
        $i= 0;
        foreach($purchaseorder as $tdata):
       ?> <tr> <td><?php echo $tdata['pay_date']; ?></td> <td><?php echo $tdata['amount']; ?></td> <td><td><?php if ($tdata['approve']=='1')
     { ?> <input type="button" onClick="save(this);" value="Yes"> <input type="button" onClick="save(this);" value="No"> ?></td> </tr> <?php
       ?> <script>
     function save(this){
type: "POST",
url: "Marketing/index.ctp",
data: {status: this.value},
success: function(data) {
  alert("Ajax save executed!");
Member Avatar for Sanchit_Sahu

What happens in Marketing/index.ctp file?

its the same page

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.