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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:07:43+00:00 2026-06-10T11:07:43+00:00

I am building a form and am currently working through validating the input. basically

  • 0

I am building a form and am currently working through validating the input.

basically what I want to do is check that they entered something, if so escape it and add it to a variable, otherwise add an error to the potential list of errors to be displayed later.

I currently have:

$category = isset($_POST['category']) ? mysqli_real_escape_string($DBConnect, $_POST['category']) : $error[] = "Which Category is this request for?";

when I do a var_dump on $category (when entered) I get NULL, when not entered I get STRING(35) “Which Category is this request for?”
I have also tried changing the line to read:

isset($_POST['category']) ? $category =  mysqli_real_escape_string($DBConnect, $_POST['category']) : $error[] = "Which Category is this request for?";

but var_dump still says it is NULL.

Could someone explain to me what I am doing wrong?

cheers,

  • 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-10T11:07:45+00:00Added an answer on June 10, 2026 at 11:07 am

    isset will only check whether that variable is set or not NULL.

    If you want to check for blank also Then please use empty This will return you the true in following cases.

    The following things are considered to be empty:

    • “” (an empty string)
    • 0 (0 as an integer)
    • 0.0 (0 as a float)
    • “0” (0 as a string)
    • NULL
    • FALSE
    • array() (an empty array)
    • $var; (a variable declared, but without a value)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently building a web form using APEX that is losely modelled after a
I'm currently building an Excel 2003 app that requires a horribly complex form and
I'm currently building an order form but it seems that the method I am
I am currently building a dynamic form that allows the user to add as
I'm currently building a very, very basic login script that basically connects to the
Good morning everyone, I'm currently building a jquery step by step form at: http://jsfiddle.net/xSkgH/
I am building a form which uses labels to define the input values (as
I'm building a login form composite component. The page that uses it will pass
I'm currently working on a cross-platform mobile app and have gone through the process
I'm currently working on a project involving a form generator. The user can switch

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.