Jump to content

auto submit form on selecting checkbox


vinpkl

Recommended Posts

hi all

 

i want to auto submit the form and run the update query on just selecting the checkbox.

 

I m able to run the update query on selecting checkbox and clicking update button.

 

But how can i auto submit form and run update query on just selecting of checkbox and without clicking the update button.

 

i m using the  below code but nothing happens

 

<form action="http://localhost/gads/catalogue.php" method="post" name="product" id="product">
<input type="checkbox" name="rural" id="rural" onchange="product.submit();"
</form>

 

 

if(isset($_REQUEST['rural']))
{
update query
}

 

vineet

Link to comment
Share on other sites

Try:

<form action="http://localhost/gads/catalogue.php" method="post" name="product" id="product">
<input type="checkbox" name="rural" id="rural" onclick="document.forms.product.submit();" />
</form>

 

hi Ken2k7

 

thanks for the reply. it works great as needed.

 

but the checkbox doesnt remain selected. can checkbox remain selected until user uncheck it.

 

or will it be done server side.

 

vineet

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.