simple isset script using $_REQUEST will not fire

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Spoooon
Forum Newbie
Posts: 5
Joined: Mon Sep 14, 2009 6:15 pm

simple isset script using $_REQUEST will not fire

Post by Spoooon »

I'm trying to get an include to fire if a variable is null
It just wont fire or do anything at the moment. Am I doing something wrong?

Code: Select all

 
<?php
 
if(!isset($_REQUEST['db_password']))
    { 
    include 'localhost/includes/database/login.inc.form.html.php';
    }   
 
?>
 
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: simple isset script using $_REQUEST will not fire

Post by jackpf »

Have you got error reporting turned on?

Try putting "echo 'blah';" in the if() statement. See if it shows up or not.
Spoooon
Forum Newbie
Posts: 5
Joined: Mon Sep 14, 2009 6:15 pm

Re: simple isset script using $_REQUEST will not fire

Post by Spoooon »

I tried that but nothing showed up.

However, then I changed the include script to

Code: Select all

 
include 'login.inc.form.html.php';
 
and it worked just fine.

why should the referral location matter? Shouldn't have I gotten at least a php error message?
Thanks for the help.
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: simple isset script using $_REQUEST will not fire

Post by jackpf »

Oh yeah, so stupid of me, didn't even look at your include file location lol.

You need to either specify a relative or absolute path. You're sort of in between...

If you're trying to include over HTTP, you need "http://" in front of "localhost". You also need url_include turned on. If not, you need to either use a relative path, so...if it's in the same directory, just the name of the script. Otherwise, you can do this:

Code: Select all

include $_SERVER['DOCUMENT_ROOT'].'/path/to/file/file.php';
I'm right in the middle of playing L4D, so sorry if this doesn't make sense, but I hope it's a bit clearer :P
Post Reply