Error when getting varible from url with PHP
Posted: 24 March 2008 08:29 AM   [ Ignore ]  
Grad Student
Avatar
Rank
Total Posts:  57
Joined  04-08-2006

Hi,

I’m getting the following error message:

Notice: Use of undefined constant cssid - assumed ‘cssid’ in mysite.com/system/core/core.functions.php(637) : eval()‘d code on line 9


The code (template) works like this:

<?php
.....
define("CSSID", $_GET[cssid], true); <-------- LINE CAUSING THE PROBLEM
.....
?>
{EE
-HTML}
....
[tags getting data from external DB using PHP above]
[
/tags]
....
{/EE-HTML}
<?php
.....
.....
?>


Actually everything works great. The data is extracted from the external DB and my special tags are looping through it and filters on the keyword. The problem is that this error line is showing up at the top of the page.

the URL looks like this:
http://www.mysite.com/index.php/template?cssid=1&csskeyword=keyword

I am running the latest version of EE, build 20080319

Any suggestions on how to make it disappear?

Thanks,
Santo

Profile
 
 
Posted: 24 March 2008 08:49 AM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  25625
Joined  05-20-2002

If you print the get array before defining your constant- does it still error?  And does it have to be a constant- does it work with

$cssid = (isset($_GET['cssid'])) ? $_GET['cssid'] : '';
 Signature 

AKA rob1

Help Request TipsPro Network

Profile
 
 
Posted: 24 March 2008 09:09 AM   [ Ignore ]   [ # 2 ]  
Grad Student
Avatar
Rank
Total Posts:  57
Joined  04-08-2006

I just love this forum!  cheese

Thanks allot! I got it to work like this:

$cssid = (isset($_GET['cssid'])) ? $_GET['cssid'] : '';
define("CSSID", $cssid, true);

Thanks,
Santo

Profile
 
 
Posted: 24 March 2008 09:10 AM   [ Ignore ]   [ # 3 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  25625
Joined  05-20-2002

Woot!  Just glad it’s working.  (I did run into some funkiness when I was playing with it as well.  Not totally sure what was up.)

 Signature 

AKA rob1

Help Request TipsPro Network

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1743, on December 02, 2009 03:47 PM
Total Registered Members: 120531 Total Logged-in Users: 84
Total Topics: 126593 Total Anonymous Users: 45
Total Replies: 665534 Total Guests: 373
Total Posts: 792127    
Members ( View Memberlist )
Newest Members:  Glenn StavaImfaelSMS!persanulandrewknightKittx77AmityBetbulJahhnvicrussell@gmail.com