Vidyalelo
PHP · Q43

HTML Forms Handling

Programming · PHP · question 43

Q43

Which one of the following statements should you use to set the session username to Nachi?

A.
$SESSION[‘username’] = “Nachi”;
B.
$_SESSION[‘username’] = “Nachi”;
Answer
C.
session_start(“nachi”);
D.
$SESSION_START[“username”] = “Nachi”;

Answer: Option B

Solution

Answer: Option B
Solution:
You need to refer the session variable ‘username’ in the context of the $_SESSION superglobal.