Welcome to Geeklog, Anonymous Monday, November 25 2024 @ 07:18 am EST

Geeklog Forums

Usersettings + checkboxes.


Status: offline

jbcorwin

Forum User
Newbie
Registered: 05/11/05
Posts: 11
Location:Houston
artistic
I've added check boxes to my install of geeklog (To the Account info, view profile pages.) that relate to the database with values of 1 or 0 (true/false...checked/unchecked.)

The files I've edited are:

usersettings.php-> I use this page for my query and to process the data. profile.thtml is were the checkboxes are written.

The code to check and write the 'checked' attribute are:

Text Formatted Code

      if ($A ['sports']== '1')
      {
       $preferences->set_var ('sports_value', 'checked');
      }
      else
      {
       $preferences->set_var ('sports_value', '');
      }

 


'sports' is the database result from the query, sports value will be show below (It comes from profile.thtml)

Text Formatted Code
<td><input type="checkbox" {sports_value} name="sports" value="{sports_num}">Sports
 


Where sports_value was already listed and sports_num = database query of sports. (Again 1 is checked, 0 is unchecked.)

I'm having problems when I modify the user settings page. If you have the value of sports come back checked, and you uncheck the value how do you save that value?

In my head I see how the page is written/parsed to make the page, but once you try to save the page how do I grab the value of the checkbox and save it back to the database?

Any help is greatly appreciated.
=P
 Quote

Status: offline

jbcorwin

Forum User
Newbie
Registered: 05/11/05
Posts: 11
Location:Houston
figured it out.
=P
 Quote

All times are EST. The time is now 07:18 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content