PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old December 23rd, 2002, 09:01 PM
goldfries goldfries is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 11 goldfries User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Undefined Variable in PHP problem.

i know there's another article on this but this one is slightly different as mine doesn't involve database.

my code looks like the one below.

Code:
<?
if($id=='' || $id=='home')
{
include ("home.php");
}
?>


this code is the only PHP code on the page. but it keeps giving me

"Notice: Undefined variable: id in c:\program files\apache group\apache\htdocs\index.php on line XX"

code on anywhere that has that code. it works normal with PHP 4.0.2 but the error message appears when using PHP 4.2.3

please do help.

Last edited by goldfries : December 23rd, 2002 at 10:32 PM.

Reply With Quote
  #2  
Old December 23rd, 2002, 09:15 PM
JayeshJain JayeshJain is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Location: Auckland,New Zealand
Posts: 31 JayeshJain User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 17
try

if isset($id)
{

}

Cheers
Jayesh Jain
__________________
Cheers

Jayesh Jain

Reply With Quote
  #3  
Old December 23rd, 2002, 09:53 PM
goldfries goldfries is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 11 goldfries User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
oh ok.


Parse error: parse error, unexpected T_ISSET, expecting '(' in c:\program files\apache group\apache\htdocs\aquaria\index.php on line 25



hrmrmr...........going to try to figure it out.

Reply With Quote
  #4  
Old December 24th, 2002, 06:07 AM
Raiak Raiak is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 2 Raiak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Try this.

Code:
if(isset($id)) {

}

Reply With Quote
  #5  
Old December 24th, 2002, 08:00 AM
bramp bramp is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 3 bramp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
also if you are using the newer PHPs you should really be using $_GET['id'] instead of just $id
(thats if you are reading it from the URL)

bramp

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > Undefined Variable in PHP problem.


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap