title: php session on undefinded constant
body: <pre><code>Notice: Use of undefined constant login - assumed 'login' in C:\wamp\www\Online_exam\header.php on line 43
  
  Notice: Use of undefined constant login - assumed 'login' in C:\wamp\www\Online_exam\header.php on line 47
  
  Notice: Use of undefined constant login - assumed 'login' in C:\wamp\www\Online_exam\index.php on line 30
  </code></pre>
  
  <p>I am new to PHP and learning SESSION, and i am trying to explore on that and i am receiving the above errors.  Everything looks correct for me.  Please somebody help me.</p>
  
  <p>Index.php</p>
  
  <pre><code>&lt;?php
      session_start();
  ?&gt;
  
  &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Wel come to Online Exam&lt;/title&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;
  &lt;link href="quiz.css" rel="stylesheet" type="text/css"&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;?php
     include("header.php");
      include("database.php");
      extract($_POST);
  
  if(isset($submit))
  {
      $rs=mysql_query("select * from mst_user where login='$loginid' and pass='$pass'");
      if(mysql_num_rows($rs)&lt;1)
      {
          $found="N";
      }
      else
      {
          $_SESSION[login]=$loginid;
      }
  }
  if (isset($_SESSION[login]))
  {
  echo "&lt;h1 class='style8' align=center&gt;Wel come to Online Exam&lt;/h1&gt;";
          echo '&lt;table width="28%"  border="0" align="center"&gt;
    &lt;tr&gt;
      &lt;td width="7%" height="65" valign="bottom"&gt;&lt;img src="image/HLPBUTT2.JPG" width="50" height="50" align="middle"&gt;&lt;/td&gt;
      &lt;td width="93%" valign="bottom" bordercolor="#0000FF"&gt; &lt;a href="sublist.php" class="style4"&gt;Subject for Quiz &lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td height="58" valign="bottom"&gt;&lt;img src="image/DEGREE.JPG" width="43" height="43" align="absmiddle"&gt;&lt;/td&gt;
      &lt;td valign="bottom"&gt; &lt;a href="result.php" class="style4"&gt;Result &lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;';
  
          exit;
  
  
  }
  
  
  ?&gt;
  &lt;table width="100%" border="0"&gt;
    &lt;tr&gt;
      &lt;td width="70%" height="25"&gt;&amp;nbsp;&lt;/td&gt;
      &lt;td width="1%" rowspan="2" bgcolor="#CC3300"&gt;&lt;span class="style6"&gt;&lt;/span&gt;&lt;/td&gt;
      &lt;td width="29%" bgcolor="#CC3333"&gt;&lt;div align="center" class="style1"&gt;User Login &lt;/div&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td height="296" valign="top"&gt;&lt;div align="center"&gt;
          &lt;h1 class="style8"&gt;Wel come to Online Quiz&lt;/h1&gt;
        &lt;span class="style5"&gt;&lt;img src="image/paathshala.jpg" width="129" height="100"&gt;&lt;span class="style7"&gt;&lt;img src="image/HLPBUTT2.JPG" width="50" height="50"&gt;&lt;img src="image/BOOKPG.JPG" width="43" height="43"&gt;&lt;/span&gt;        &lt;/span&gt;
          &lt;param name="movie" value="english theams two brothers.dat"&gt;
          &lt;param name="quality" value="high"&gt;
          &lt;param name="movie" value="Drag to a file to choose it."&gt;
          &lt;param name="quality" value="high"&gt;
          &lt;param name="BGCOLOR" value="#FFFFFF"&gt;
  &lt;p align="left" class="style5"&gt;&amp;nbsp;&lt;/p&gt;
        &lt;blockquote&gt;
            &lt;p align="left" class="style5"&gt;&lt;span class="style7"&gt;Wel Come to Online 
              exam. This Site will provide the quiz for various subject of interest. 
              You need to login for the take the online exam.&lt;/span&gt;&lt;/p&gt;
        &lt;/blockquote&gt;
      &lt;/div&gt;&lt;/td&gt;
      &lt;td valign="top"&gt;&lt;form name="form1" method="post" action=""&gt;
        &lt;table width="200" border="0"&gt;
          &lt;tr&gt;
            &lt;td&gt;&lt;span class="style2"&gt;Login ID &lt;/span&gt;&lt;/td&gt;
            &lt;td&gt;&lt;input name="loginid" type="text" id="loginid2"&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
            &lt;td&gt;&lt;span class="style2"&gt;Password&lt;/span&gt;&lt;/td&gt;
            &lt;td&gt;&lt;input name="pass" type="password" id="pass2"&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
            &lt;td colspan="2"&gt;&lt;span class="errors"&gt;
              &lt;?php
            if(isset($found))
            {
              echo "Invalid Username or Password";
            }
            ?&gt;
            &lt;/span&gt;&lt;/td&gt;
            &lt;/tr&gt;
          &lt;tr&gt;
            &lt;td colspan=2 align=center class="errors"&gt;
            &lt;input name="submit" type="submit" id="submit" value="Login"&gt;       &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
            &lt;td colspan="2" bgcolor="#CC3300"&gt;&lt;div align="center"&gt;&lt;span class="style4"&gt;New User ? &lt;a href="signup.php"&gt;Signup Free&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;
            &lt;/tr&gt;
        &lt;/table&gt;
        &lt;div align="center"&gt;
          &lt;p class="style5"&gt;&lt;img src="images/topleft.jpg" width="134" height="128"&gt;          &lt;/p&gt;
          &lt;/div&gt;
      &lt;/form&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  
  Header.php
  
  &lt;style type="text/css"&gt;
  &lt;!--
  body {
      margin-left: 0px;
      margin-top: 0px;
  }
  --&gt;
  &lt;/style&gt;
  &lt;table border="0" width="100%" cellspacing="0" cellpadding="0" background="image/topbkg.jpg"&gt;
    &lt;tr&gt;
      &lt;td width="90%" valign="top"&gt;
  &lt;!--You can modify the text, color, size, number of loops and more on the flash header by editing the text file (fence.txt) included in the zip file.--&gt;
  &lt;div align="left"&gt;&lt;object classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000
  codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,2,0
  width=500
  height=68&gt;
  &lt;param name=movie value=image/fence.swf&gt;
  &lt;param name=quality value=high&gt;
  &lt;param name=BGCOLOR value=#000000&gt;
  &lt;param name=SCALE value=showall&gt;
  &lt;param name=wmode value=transparent&gt; 
  &lt;embed src=image/fence.swf
  quality=high
  pluginspage=http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash type=application/x-shockwave-flash
  width=500
  height=68
  bgcolor=#000000
  scale= showall&gt;
  &lt;/embed&gt;
  &lt;/object&gt;&lt;/div&gt;&lt;/td&gt;
      &lt;td width="10%"&gt;
       &lt;img border="0" src="image/topright.jpg" width="203" height="68" align="right"&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  &lt;table border="0" width="100%" cellspacing="0" cellpadding="0" bgcolor="#000000" background="img/blackbar.jpg"&gt;
    &lt;tr&gt;
      &lt;td width="100%" align="right"&gt;&lt;img border="0" src="image/blackbar.jpg" width="89" height="15"&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/Table&gt;
    &lt;Table width="100%"&gt;
    &lt;tr&gt;
    &lt;td&gt;
    &lt;?php "Hi ".$_SESSION[login]; ?&gt;
    &lt;/td&gt;
      &lt;td&gt;
      &lt;?php
      if(isset($_SESSION[login]))
      {
       echo "&lt;div align=\"right\"&gt;&lt;strong&gt;&lt;a href=\"index.php\"&gt; Home &lt;/a&gt;|&lt;a href=\"signout.php\"&gt;Signout&lt;/a&gt;&lt;/strong&gt;&lt;/div&gt;";
       }
       else
       {
          echo "&amp;nbsp;";
       }
      ?&gt;
  
    &lt;/tr&gt;
  
  &lt;/table&gt;
  </code></pre>