Jump to content


Photo

mysql, php and form checkboxes


  • Please log in to reply
2 replies to this topic

#1 tjhilder

tjhilder
  • Members
  • PipPipPip
  • Advanced Member
  • 136 posts
  • LocationKent, UK

Posted 13 January 2006 - 10:50 AM

******* SOLVED ************

managed to figure it out, although i noticed that checkboxes either set to 'on' or nothing, so I had to create a script to display 1 if on and else: 0

***************************

Hi,

I have 3 colums in my members table (well i have more but i'm focusing on these 3 :P)

setting_lastname
setting_email
setting_location

I want to make it so that if a checkbox is ticked on a form, it will return the value of 1 (the view_profile.php looks for the value of 1 and shows data, if 0 it doesn't display it) and unticked is value of 0

although I don't know how I would work this with PHP and mysql, obviously i know how to make the form name the checkboxes etc, but how do I make them use a value that i set?

can someone help me? many thanks in advance.

#2 siberyak

siberyak
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 14 January 2006 - 06:18 AM



use code like this:

if($setting_lastname=="on")
$display_lastname=1;
else
$display_lastname=0;

and so on...

visit www.configure-all.com

#3 tjhilder

tjhilder
  • Members
  • PipPipPip
  • Advanced Member
  • 136 posts
  • LocationKent, UK

Posted 14 January 2006 - 01:58 PM

thanks for your reply, but as mentioned in my last post i already made a script simular to that.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users