/    Sign up×
Community /Pin to ProfileBookmark

Errors Galore :(

Ok, here’s my problem:
[url]http://www.summel.net/cobalt/admin[/url]

Here’s the error that pops up:

[QUOTE]

Notice: Undefined index: section in /home/summel/www/www/cobalt/admin/index.php on line 50

[/QUOTE]

Here’s the code for that div:

[CODE]<div class=”main_right_column”>
<?php

// MAIN SWITCH STATEMENT
switch($_GET[‘section’])
{
// SECTION = “”
default:
echo “<div style=”text-align: right;”>”;
echo “<img src=”../images/cobalt_welcomeheader.png” alt=”Welcome to Cobalt!” />”;
echo “</div>”;
echo “<h5 class=”welcome” style=”font-weight: 100;”>”;
echo “Cobalt Download Manager was designed to help webmasters offer feature-rich download capabilities to their users rather simply and rather quickly.”;
echo “</h5>”;
break;

// SECTION = “category”
case “category”:
include(‘includes/sections/categories.php’);
break;

// SECTION = “download”
case “download”:
include(‘includes/sections/downloads.php’);
break;

case “login”:
echo(“Login”);
break;

}

?>
</div>[/CODE]

Can anyone tell what the problem is resulting from?
I asked a friend of mine and I couldn’t recall if he gave me a solution for it or not.

Thanks, guys.

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@NogDogNov 23.2005 — I think you'll have better luck with this:
[code=php]
<div class="main_right_column">
<?php
// set section if set in the GET variable, else init it to ""
$section = (isset($_GET['section']) ? $_GET['section'] : "";

// MAIN SWITCH STATEMENT
switch($section)
{
// SECTION = "category"
case "category":
include('includes/sections/categories.php');
break;

// SECTION = "download"
case "download":
include('includes/sections/downloads.php');
break;

case "login":
echo("Login");
break;

// SECTION = ""
default:
echo "<div style="text-align: right;">";
echo "<img src="../images/cobalt_welcomeheader.png" alt="Welcome to Cobalt!" />";
echo "</div>";
echo "<h5 class="welcome" style="font-weight: 100;">";
echo "Cobalt Download Manager was designed to help webmasters offer feature-rich download capabilities to their users rather simply and rather quickly.";
echo "</h5>";
break;

}

?>
</div>
[/code]
Copy linkTweet thisAlerts:
@tgrk35authorNov 23.2005 — I think you'll have better luck with this:
[code=php]
<div class="main_right_column">
<?php
// set section if set in the GET variable, else init it to ""
$section = (isset($_GET['section']) ? $_GET['section'] : "";

// MAIN SWITCH STATEMENT
switch($section)
{
// SECTION = "category"
case "category":
include('includes/sections/categories.php');
break;

// SECTION = "download"
case "download":
include('includes/sections/downloads.php');
break;

case "login":
echo("Login");
break;

// SECTION = ""
default:
echo "<div style="text-align: right;">";
echo "<img src="../images/cobalt_welcomeheader.png" alt="Welcome to Cobalt!" />";
echo "</div>";
echo "<h5 class="welcome" style="font-weight: 100;">";
echo "Cobalt Download Manager was designed to help webmasters offer feature-rich download capabilities to their users rather simply and rather quickly.";
echo "</h5>";
break;

}

?>
</div>
[/code]
[/QUOTE]



Now it's giving me an error:

Parse error: syntax error, unexpected ';' in /home/summel/www/www/cobalt/admin/index.php on line 47

Line 47 is the "$section = (isset($_GET['section']) ? $_GET['section'] : "";" you gave me :-$.

Ideas?
Copy linkTweet thisAlerts:
@tgrk35authorNov 23.2005 — GOT IT ?

There was an extra ( in front of isset.

Thanks, man ?.

Worked perfectly ?
Copy linkTweet thisAlerts:
@NogDogNov 23.2005 — Or a missing one at the end of the condtion. I'd intended it to be:
[code=php]
$section = (isset($_GET['section'])) ? $_GET['section'] : "";
[/code]

I just find it easier to read that way, but it's not required in this case.
×

Success!

Help @tgrk35 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...