Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8092631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:19:35+00:00 2026-06-05T20:19:35+00:00

I have a table: CREATE TABLE siteConfig ( settingName VARCHAR(64) NOT NULL, value VARCHAR(255),

  • 0

I have a table:

CREATE TABLE siteConfig (
    settingName     VARCHAR(64) NOT NULL,
    value           VARCHAR(255),
    PRIMARY KEY (settingName)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

display these setting.
settingdisplay.php

$setting = siteConfig::find_all();

    $this_page = array(
                        'recaptcha_public_key','recaptcha_private_key','spam_register','spam_login',
                        'spam_register_emp','spam_login_emp','spam_apply','spam_contact','spam_share',
                        'spam_feedback','spam_forgot','spam_rsc'
                       );

    foreach ( $setting as $s )
    {
        if( in_array($s->settingName, $this_page) )
        {
            $_SESSION['set_ses'][ $s->settingName ] = isset($_SESSION['set_ses'][ $s->settingName ]) ? $_SESSION['set_ses'][ $s->settingName ] : $s->value;
        }
    }

part of html which is displaying these setting.

<tr>
    <td>&nbsp;</td>
    <td>{lang mkey='label' skey='spam_register'}</td>
    <td><input type="checkbox" name="txt_setting[spam_register]" id="spam_register" class="checkboxField" {if $smarty.session.set_ses.spam_register == 1 } checked="checked"{/if} /></td>
</tr>

once all the information is change then this page save it to database.
Update.php

foreach( $_POST['txt_setting'] as $k => $v )
    {
        $setting->settingName   = $k;
        $setting->value     = $v;

        if( $setting->updateSiteConfig() )
            $k = true;
    }

When I check the box my update.php see nothing.

I dont know how to get 1 or 0 value from these checkbox.

Fixed……………..

$yes_or_no_key=array(list of my keys);
if( in_array($k, $yes_or_no_key) )
        {
            $setting->value = $_POST['txt_setting'][$k] == 'on' ? 1 : 0;
        }

This fixed my problem. Thank you for your qick response.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T20:19:37+00:00Added an answer on June 5, 2026 at 8:19 pm

    value of checkboxs are sent ONLY if they’re checked! – Death

    So you need something like this:

    if (!isset($_POST['txt_setting[spam_register]']) $_POST['txt_setting[spam_register]'] = 0; // 0 value
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this table: CREATE TABLE Persons ( P_Id int NOT NULL, LastName varchar(255)
I have a table: create table A ( KEY VARCHAR(1024) not null ); where
I have this table: CREATE TABLE `table1` ( `object` varchar(255) NOT NULL, `score` decimal(10,3)
I have this table create table utilizator( utilizatorId bigint not null auto_increment primary key,
I have this table CREATE TABLE [dbo].[friend_blocked_list]( [subdomain] [varchar](50) NOT NULL, [un] [nvarchar](50) NOT
i have this table create table eveniment( + evenimentId bigint not null auto_increment primary
I have this table: create table demo ( key number(10) not null, type varchar2(3)
I have a table: CREATE TABLE [Lines] ( [Value] TEXT NOT NULL, [AddedOn] TIMESTAMP
I have a table: CREATE TABLE `data_table` ( `data_id` INT NOT NULL AUTO_INCREMENT PRIMARY
well I have a table create table usersnew ( user1 varchar (50) primary key,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.