Jump to content

using php & Javascrip to pass form on checkbox


nade93

Recommended Posts

Hi All

 

I am trying to update a database when a checkbox has been checked without using a submit button

 

Please find code below:

 

<form action="<? echo $PHP_SELF ; ?>" method="post" >
       <input type='checkbox' id="css_sized_container" name="checkbox[".$row['onoff']."]" value='<? echo $row['onoff']; ?>' onclick='document.form".$row['onoff'].".submit();' />

        </form>
        
        <? include('../lib/conn.php'); 
	$ifchecked = $_REQUEST['checkbox'];
	mysql_query("UPDATE users_audio SET onoff='' WHERE userid='1'");
	 ?>

 

basically, i want the user to check or uncheck the box, this be passed to the database then the checkbox remembers the answer for that user from the database (i.e. $row['onoff']; )

 

Any help would be amaing as very stuck!

 

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.