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 6051645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:50:29+00:00 2026-05-23T07:50:29+00:00

I have a form validation issue. Below is the logic that happens on submit

  • 0

I have a form validation issue. Below is the logic that happens on submit (part of it at least.) In the for loop, we check an array of possible events that a site visitor can register for. If the user hasn’t checked any events (these are checkboxes because a user can register for multiple events), we should enter the second if statement below, but for some reason we’re not. I know that none of the post variables are set if nothing is checked and, by setting a session variable equal to the variable $ECEventCnt, I’m able to varify that if nothing is posted, that variable is equal to 0. However, we seem to never get into the second if statement. Any thoughts?

unset($_SESSION["ECEvents"]);
        $ECEventsArray = array();
        $ECEventCnt = 0;
        $_SESSION['debug'] = 'EC';
        for ($i=0; $i<count($Val_WhichEventTypes); $i++) {
            $key = $Val_WhichEventTypes[$i]["eventKey"];
            //echo 'key' . $key;
            if (isset($_POST["WhichEvent-" . $key]) && $_POST["WhichEvent-" . $key] == $key) {
                $_SESSION['debug'] .= ' we made it to the place.' . $_POST["WhichEvent-" . $key];
                 $ECEventsArray[$key] = $key ;
                 if (strlen($ECEventsArray[$key])) $ECEventCnt += 1;  // Only advance counter if EC Event is checked (key value is set)
            }
        }
        $_SESSION['ecventcount'] = $ECEventCnt;
        if ($ECEventCnt = 0) {
            set_step_INvalid(5);
            $_SESSION['debug'] .= ' we made it to the 2nd place.';
            $cnt += 1;
            $ValidationError .= ((strlen($ValidationError)==0) ? "" : ", ") . "<br />Please just select at least one Event Type/Time";
        }
        $_SESSION["ECEvents"] = $ECEventsArray;
        //valid_step52();

    }
  • 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-23T07:50:29+00:00Added an answer on May 23, 2026 at 7:50 am
    if ($ECEventCnt = 0) {
    

    should be

    if ($ECEventCnt == 0) {
    

    You are assigning to the variable $ECEventCnt, but what you mean to do is compare using it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an issue, where by I am doing a simple form validation, that
Form validation for check boxes only seems to be working in IE....? Anyone have
I have a small jQuery plugin that I use for form AJAX validation. There
I have a Django form that needs to do some client-side validation before submitting
I'm having a validation issue that I can't figure out. I know I have
I have a large validation form that is working very well except for one
I have created an form validation using ajax/php. Each text box is validated using
I have a multi-lingual page where I want to display form validation error in
I am using jquery validation plugin for form validation. I have added a custom
I have a registration form leveraging xVal to handle all validation on the form.

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.