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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:01:22+00:00 2026-06-15T05:01:22+00:00

If I use isset() for a text input then I write it like this:

  • 0

If I use isset() for a text input then I write it like this:

$newpass = (isset($_POST['newpass'])) ? $_POST['newpass'] : '';

Now if I have a drop down menu like below:

<select name="students">
<option value="">Please Select</option>
<option value="john">John Doe</option>
<option value="Mike">Mike Smith</option>
</select>

Then can I use the same type of isset as I have used for text input:

$studentsdrop = (isset($_POST['students'])) ? $_POST['students'] : '';

or is the isset different fro a drop down menu?

  • 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-15T05:01:23+00:00Added an answer on June 15, 2026 at 5:01 am

    isset() checks to see if a variable exists and that it is not set to NULL. It is not related to HTML at all.

    In your case:

    $studentsdrop = (isset($_POST['students'])) ? $_POST['students'] : '';
    

    As long as you knew that students was going to be present you wouldn’t need this.
    The most common time isset() is used upon form submits, is determining a checkbox. For example if you submit a form that has a checkbox, and that checkbox was not checked, it would not be passed into the $_POST variable. This is crucial to use:

    $checkbox_name = isset($_POST['checkbox_name']) ? $_POST['checkbox_name'] : '';

    In the case of a select the $_POST variable will always return, even if it is empty.

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

Sidebar

Related Questions

I have come across scripts that use: isset($_POST['submit']) as well as code that uses:
If the user manually clicks the 'submit' button, i use this code: if (isset($_POST['submit_findall']))
i have this form: <form id=myform name=myform action=test.php method=post> <input type=text name=shout-in id=proShoutIn maxlength=80
so I have: $input=array($fname,$lname); I then use: $valueString = join(,,$values); echo $valueString; if I
I was trying to use this code: if($_SERVER['HTTP_PORT'] !== 443 && !isset($_SERVER['HTTPS'])) { header('Location:
I am developing a custom homepage background,in my html have <form action='.$_SERVER['PHP_SELF'].'> <input type=text
I use jquery to post data to mysql. **In settings.php i have this short
use Text::Table; my $tb = Text::Table->new(Planet,Radius\nkm,Density\ng/cm^3); $tb->load( [ Mercury,2360,3.7], [ Mercury,2360,3.7], [ Mercury,2360,3.7], );
I would like to apologize if the duplicate of this question exist. i tried
When I use PHP to set the value of a HTML form input element,

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.