Undefined Index error

Hey everyone! i am working on a website, i am having a problem in it. I am saving pin of the user in session and i am calling that pin in the main page, when i called it it gets an error of
Notice: Undefined index: PIN in D:\wamp\www\mano\membersweb.php on line 81
Call Stack #timememoryfunctionlocation 10.0007383464 {main}()

here i am putting the pin in session
[php]

<?php session_start(); include"config.php"; $username=$_REQUEST['uname']; $password=$_REQUEST['pass']; $pin = ""; $sql="SELECT id,pin FROM userinfo u WHERE uname='$username' AND pass='$password' "; echo $sql; $result=mysql_query($sql); while($entity=mysql_fetch_assoc($result)){ $pin = $entity['pin']; $_SESSION['id'] = $entity['id']; } $_SESSION['pin'] = $pin; header("location:mlogprocess.php?pin=".$pin); ?>

[/php]

and here i am calling it

<div id="topnav">
      <ul>
        <li class="active"><a href="index.html">Home</a></li>
        <li><a href="about.html">About</a></li>
        <li>
        </li>
        <li ><a href="services.html">Services</a></li>
<li ><a href="membersweb.php?pin=<?php session_start(); $pin = $_SESSION['pin']; echo $pin; ?> ">Profile</a></li>
        
      </ul>
    </div>

Hi Aneeb,

You have a syntax error there. session start MUST only be on the top of the php file. In your second page, this line: <?php session_start(); $pin = $_SESSION['pin']; echo $pin; ?> should be changed to:

<?php $pin = $_SESSION['pin']; echo $pin; ?>. Then, on top of this page, insert this: <?php session_start(); ?>. Remember, it MUST be the first line.

Good luck!

Regards,
developer.dex2908

Sponsor our Newsletter | Privacy Policy | Terms of Service