Undefined index: username HELP NEWBIE


Posted on 16th Feb 2014 07:03 pm by admin

I am trying a simple login/logout for my website. It works well with checking if the username exists in the database to logging in. I used $_SESSION['username']=$myusername; However, when I log-out, then I go to a page with this code

Code: <?php

Did you know?Explore Trending and Topic pages for more stories like this.
session_start();

if($_SESSION['username']) //line5
echo "Welcome, ".$_SESSION['username']."!<br /><a href='logout.php'>Logout.</a>";
else
die ("You must be logged in!");

?>

It gives me an error. It says Notice: Undefined index: username in C:wampwwwdatbasmember.php on line 5

I just want to know how to fix this. Thank you
No comments posted yet

Your Answer:

Login to answer
233 Like 43 Dislike
Previous forums Next forums
Other forums

PHP IMAGE UPLOAD SCRIPT
Hi for the last week i have been looking for scripts that will upload a photo to a certain folder wh

Update Database
Hi All,


I have a problem with this:

Code: [Select]<?php
session_start();

Gerenate tabel in Php
I whant to generate a tabel takeing data from database like this one so the results to be display on

help retrieiving results and doing pagination
Having some trouble trying to get the results to show on more than just one page.

What is ha

check_changed_data - I can't get data from the called method event
I use check_changed_data to trigger my event method.

The method delivers er_changed_data.

Solution Manager BPR
Does the SolMan-BPR-ARIS-Integration (http://www.ids-scheer.com/en/ARIS/ARIS_Platform/ARIS_Business_

Displaying a clickable playername
I am going wrong somewhere with the mysql_query, can someone please put me straight?

$playern

Strange PHP/mySQL error ... am I just tired?
Code: <?

## CONNECT TO DB FUNCTION!
function ConnectTo($db2con)
{
$hostNam

(sub)screen resize modification doesn't work after ECC 6 EhP 4 installation
Hello,

We have previously extended the size of the custom data tab on PO transaction ME23

firefox wouldnt stream mp3 files completely from my php page
hi everyone,
I have a php file trying to read and stream mp3 files. It works fine in IE but my pr

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash