Jump to content

Checking for undefined variables


Frezzwar

Recommended Posts

Hi.

I'm still very new to this forum, so i may be asking this the wrong way.

I'm working on a project, but i keep running into the same wall.

Whenever i try to load a page with a variable i named on another page, i get an error telling me that it does not know that variable.

But how do i make it check for the variable before using it?

Example of my code (i only show the first part, as it is the only one relevant):

<html><body>
<?php

session_start();
if($_SESSION['username']);
{
	$username = $_SESSION['username'];

As you can see i have tried to deal with it using an if statement, but i still get the error.

I bet there is a very simple way to do this, but i cant see it right now.

Link to comment
https://forums.phpfreaks.com/topic/233261-checking-for-undefined-variables/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.