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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.