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

  • Home
  • SEARCH
  • 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 3433194
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T07:32:38+00:00 2026-05-18T07:32:38+00:00

OK I am sending data with $_POST to itself. I have some checkboxes that

  • 0

OK I am sending data with $_POST to itself.
I have some checkboxes that I have checked by default. (1 & 2 in this example)
When the form is sumbitted I want to override these default’s with the $_POST value.

<?php
    $syndication_check_1 = 'checked="checked"';
    $syndication_check_2 = 'checked="checked"';
    $syndication_check_3 = '';
    if (isset($_POST['syndication'])) {
        //
    }
?>

<form name="form" method="post" action="">
    <!-- this is what I use for radiobuttons -->
    <legend>Sex:</legend>
    <input type="radio" name="sex" id="sex-1" value="M" <?php echo (!isset($_POST['sex']) || $_POST['sex'] == "M") ? 'checked="checked"': ''; ?> />
    <label for="sex-1"><?= _("Male"); ?></label>
    <input type="radio" name="sex" id="sex-2" value="F" <?php echo (isset($_POST['sex']) && $_POST['sex'] == "F") ? 'checked="checked"': ''; ?> />
    <label for="sex-2"><?= _("Female"); ?></label>

    <!-- now something similar for checkboxes -->
    <legend>Syndication:</legend>
    <input type="checkbox" name="syndication[]" id="syndication-1" value="yahoo" <?= $syndication_check_1; ?> /> <!-- checked -->
    <label for="syndication-1">Yahoo Real Estate</label>
    <input type="checkbox" name="syndication[]" id="syndication-2" value="trulia" <?= $syndication_check_2; ?> /> <!-- checked -->
    <label for="syndication-2">Trulia.com</label>
    <input type="checkbox" name="syndication[]" id="syndication-3" value="zillow" <?= $syndication_check_3; ?> />
    <label for="syndication-3">Zillow.com</label>
</form>
  • 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-05-18T07:32:39+00:00Added an answer on May 18, 2026 at 7:32 am

    Id probably do something like this…

    $syndicationCheck = array(
      'yahoo' => null,
      'trulia' => null,
      'zillow' => null
    );
    
    if(isset($_POST['syndication'])){
      foreach($_POST['syndication'] as $value){
        $syndicationCheck[$value] = 'checked';
      }
    }
    
    
    <legend>Syndication:</legend>
        <input type="checkbox" name="syndication[]" id="syndication-1" value="yahoo" <?= $syndicationCheck['yahoo']; ?> /> <!-- checked -->
        <label for="syndication-1">Yahoo Real Estate</label>
        <input type="checkbox" name="syndication[]" id="syndication-2" value="trulia" <?= $syndicationCheck['trulia']; ?> /> <!-- checked -->
        <label for="syndication-2">Trulia.com</label>
        <input type="checkbox" name="syndication[]" id="syndication-3" value="zillow" <?= $syndicationCheck['zillow']; ?> />
        <label for="syndication-3">Zillow.com</label>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an HTML form - with PHP, I am sending the data of
We have a mobile Application in a very unsteady WLan Environment. Sending Data to
I'm sending some data over AJAX to a PHP file. It's about filter options.
I have data in a MySQL database. I am sending the user a URL
Okay all, I have a form that I want users to fill out. When
When sending data over HTTPS, I know the content is encrypted, however I hear
They both seem to be sending data to the server inside the body, so
My web server has a lot of dependencies for sending back data, when it
My WCF service involves the sending of a dataset (in csv format) data between
I am having some trouble with foreign characters when sending an e-mail. Could someone

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.