By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,529 Members | 1,826 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,529 IT Pros & Developers. It's quick & easy.

upload and insert into database using checkbox

P: 38
hi
i have a field in my database (status) which have the value 0 or 1

how can i update these value using check box
if checked then 1
if not checked then 0

and also how to insert values using checkbox

thanks for any help
Nov 28 '07 #1
Share this Question
Share on Google+
5 Replies


Markus
Expert 5K+
P: 6,050
hi
i have a field in my database (status) which have the value 0 or 1

how can i update these value using check box
if checked then 1
if not checked then 0

and also how to insert values using checkbox

thanks for any help
You don't explain it very well but here goes -

for the first part

Expand|Select|Wrap|Line Numbers
  1. <form name="form_name" action="..." method="post">
  2.  <input type="checkbox" name="box1" />
  3.  //other inputs
  4. </form>
  5.  
When the form is submitted, check if the checkbox was checked:
[php]
if(isset($_POST['box1'])){
//box was checked - execute relevant code
} else {
//box wasnt checked - execute relevant code
}
[/code]

I have no idea what you're talking about in the second part though..

:)
Nov 28 '07 #2

P: 38
thank u very much for your help markusn00b

i just did this

if(isset($_POST['available'])){
$tick=0;
}
else{
$tick=1;
}

and then insert it with the variable '$tick' value

and it worked
Nov 28 '07 #3

Markus
Expert 5K+
P: 6,050
thank u very much for your help markusn00b

i just did this

if(isset($_POST['available'])){
$tick=0;
}
else{
$tick=1;
}

and then insert it with the variable '$tick' value

and it worked
Awesome, i'm glad!

Post back whenever you need help :)
Nov 28 '07 #4

P: 7
please help me how i can insert records on the database and to view it,,would anyone like to send me the code???i'm just a beginner in PHP...thanks
Dec 3 '07 #5

P: 7
would anyone like to send me the code how to insert records on the database???please send me the code...thanks
Dec 3 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.