Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6651749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:02:53+00:00 2026-05-26T01:02:53+00:00

I wish to update MYSQL data using text instead of using submit button. Admin

  • 0

I wish to update MYSQL data using text instead of using submit button.
Admin will choose option from combobox and then click at save to update the MYSQL records.
How to do this using AJAX or jquery?

My coding:

<?php

include('config.php');

$per_page = 9; 

if($_GET)
{
$page=$_GET['page'];
}



//get table contents
$start = ($page-1)*$per_page;
$sql = "SELECT bookingID,eventinfo.eventTitle,boothAlias,testbook.bstatus,date, testbook.username, customer.companyName, customer.contactName from eventinfo, testbook, customer where testbook.username=customer.username AND testbook.eventID=eventinfo.eventID order by date desc limit $start,$per_page";
$rsd = mysql_query($sql);
?>

<form method="post" name="form">
<table width="800px">

    <?php
    //Print the contents

    while($row = mysql_fetch_array($rsd))
    {

        $id=$row['companyName'];
        $contactName=$row['contactName'];
        $eventTitle=$row['eventTitle'];
        //$phone=$row['phone'];
        $date=$row['date'];
        $status=$row['bstatus'];
        $booth=$row['boothAlias']

    ?>
    <tr><td style="color:#B2b2b2; padding-left:4px"><?php echo $id; ?></td><td><?php echo $contactName; ?></td>
    <td><?php echo $eventTitle; ?></td><td><?php echo $booth; ?></td><td><?php echo $date; ?></td><td><select name='status' id='status'>
        <option value='-1'>--Select--</option>
    <option value='0'>Approve</option>
    <option value='1'>Reject</option>
    <option value='2'>Pending</option>
    </select></td><td><a href=#>save</a></td>
    </tr>
    <?php
    } //while
    ?>
</table>
</form>

image

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T01:02:54+00:00Added an answer on May 26, 2026 at 1:02 am

    This is actually really simple using jQuery. First, you have to create another PHP script that will actually run the UPDATE code. I’m not sure how much you know about AJAX requests, but you can essentially think of them as your browser opening a new tab in the background, sending the request and returning/parsing the response with JavaScript.

    So, I’d write a PHP script that you can request (maybe “update_field.php” or “update_field_ajax.php”) which does the actual updating. Write this script as you would if a form were being submitted from another page (ie it’ll have POST and GET variables, validations, etc). There will be two main differences. First, you’ll pass in the POST params with jQuery and second you won’t return HTML (you can return HTML if you want – but if you’re doing a simple update you really only need some sort of success or fail/error message response). I’d consider JSON for the response type. So, the PHP script is up to you to write, you’ll write it just as you normally.

    Next, you’ll use jQuery to grab the data (GET/POST params) from the page and make a request to the PHP script you created. This isn’t all that bad either. I’m not sure what you mean by “using text instead of a submit button” other than you don’t want to use a submit button so I’ll explain this in a somewhat abstract way. In order to get the AJAX call to run you must have something trigger it. This will be an event on the page, and that event will call a function that fires the AJAX request. Google around for information on jQuery events, but essentially when an event is fired it calls a function that you define. When that function is called we can use jQuery’s post() method to create an AJAX post request. This method call will look something like:

    jQuery.post('url of your script', {postVarOne: jQuery('some elt').val()}, function () {success function}, 'json');
    

    The details of jQuery.post can be found at http://api.jquery.com/jQuery.post/

    So basically write a PHP script as you normally would that returns something other than HTML signifying success/fail or a response message(unless you need to inject HTML right into the page) and then use jQuery.post (or jQuery more generic jQuery.ajax method) to have your browser request that script with the GET/POST vars you define and parse the response.

    Finally, check out these tutorials for more information/code examples.

    http://www.devirtuoso.com/2009/07/beginners-guide-to-using-ajax-with-jquery/

    http://www.php4every1.com/tutorials/jquery-ajax-tutorial/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wish to test a function that will generate lorem ipsum text, but it
I'm using a stored procedure to update\insert data into a table using MERGE. One
I have a list of elements and I wish to update them: from this:
I wish to know all the pros and cons about using these two methods.
I wish to migrate the database of a legacy web app from SQL Server
I have 1 million rows in MySql table temp and wish to multiply column
Update : I just found this documentation page . Wish there was a link
Do you wish to reload the project? Where's the Reload All option. Vote for
I wish to save some semantic information about data in a table. How can
To maintain my purity and honor as a database dork, I wish to update

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.