Forum Moderators: coopster

Message Too Old, No Replies

Updating records from Checkbox to database

         

kelpem

4:11 am on Dec 4, 2008 (gmt 0)

10+ Year Member



Hi,
here i am lost in between, actually i wanted to retrieve the value of checkbox to database using some Javascript also, but i had some problem doing it. If any body can help me out with this problem.
I have two options, as Activate and Disconnect and that either i check activate or disconnect is to be updated in table status, if you kindly help me solve this problem i would be proceeding too next step and will be thank ful,
i hope i made my description of problem clearly.

thanks in advance

kelpem

jatar_k

6:39 pm on Dec 4, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld kelpem,

what code do you have at the moment? Is anything working?

are you having trouble getting the state of the checkbox? or is it the update statement that is giving you trouble?

kelpem

3:59 am on Dec 5, 2008 (gmt 0)

10+ Year Member



Actually i am stagnant here where i could not process further since it isn't working, I have code as below:

------This is my Javascript-----

<script type="text/javascript">

function validate(form) {
// Checking if at least one period button is selected. Or not.
if (!document.form1.status[0].checked && !document.form1.status[1].checked){

alert("Please Select the status");
return false;}

alert ("The period button validation is completed")
return true;

}

</script>

And this is where i have shown the Out put as,

<table width='62%' border='0' align="center" cellpadding='0' cellspacing='0' >
<!--form name=form1 method=post action=customer.php onsubmit='return validate(this)' -->
<form name="form1" method="post" action="status.php" onsubmit="return validate(this)">

<tr bgcolor='#ffffff'>
<td align=center ><font face='verdana' size='2'><b>status</b>

<input type="radio" name="status" value="activate" />
Activate </font>
<input type="radio" name="status" value="disconnect" />
Disconnect</td>
</tr>
<tr bgcolor='#ffffff'><td align=center ><input type="submit" value="Submit" />
<input type="reset" value="Reset"/></td></tr>
</form>
</table>

--------------------------

here i have two options as Activate and disconnect, where when i check any of the option, the ALERT message appears and then after clicking on OK the value should be Updated in database i.e. tblStatus,
(Little overview on my database,
i have database dbCustomerLeaseline,
in that i have table name as tblStatus

so here i am to update the record of checkbox to tblStatus where ever i check,i.e. on Activate or Disconnect.

I hope i made it clear On this regard, to jatar_k.

thanking you in advance.

kelpem