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
https://forums.phpfreaks.com/topic/162996-auto-submit-form-on-selecting-checkbox/
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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.