Bird
0
0

Which of the following is the correct syntax to access a form field named email sent via POST in PHP?

easy📝 Syntax Q3 of 15
PHP - Superglobals and Web Context
Which of the following is the correct syntax to access a form field named email sent via POST in PHP?
A$_POST[email]
B$POST['email']
C$_POST['email']
D$_POST->email
Step-by-Step Solution
Solution:
  1. Step 1: Understand PHP array syntax

    $_POST is an associative array; keys must be in quotes when accessed.
  2. Step 2: Check each option

    $_POST[email] misses quotes, $POST['email'] uses wrong variable name, $_POST->email uses object syntax which is invalid here.
  3. Final Answer:

    $_POST['email'] -> Option C
  4. Quick Check:

    Access POST data with $_POST['field'] [OK]
Quick Trick: Use $_POST['fieldname'] to get POST form data [OK]
Common Mistakes:
  • Omitting quotes around the key
  • Using $POST instead of $_POST
  • Using object notation instead of array

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes