Page 1 of 1

$_GET problem. Please help?

Posted: Wed Mar 25, 2009 9:53 pm
by UCC_Achilles
Having problem with the following. Help would be amazing:

Code: Select all

 
<html>
<head>
<title>Untitled Document</title>
</head>
 
<body>
 
<?php
$uct = 'Hello, welcome to the home page';
$services = 'Our services include the following';
$portfolio = 'portfolio is the following';
$resources = 'resources are Here!';
$about = 'This is what we about.';
$contact = 'check it if u wanna contact';
 
?>
 
<?php
 
echo '<a href="index.php?uct=home">Index | </a>';
echo '<a href="index.php?uct=services">Services | </a>';
echo '<a href="index.php?uct=portfolio">Portfolio | </a>';
echo '<a href="index.php?uct=resources">Resources | </a>';
echo '<a href="index.php?uct=about">About | </a>';
echo "<a href='index.php?uct=contact'>Contact | </a>";
 
?>
 
<?php
 
echo $_GET['.uct.'];
 
?>
 
</body>
</html>

Re: $_GET problem. Please help?

Posted: Wed Mar 25, 2009 10:10 pm
by Christopher

Code: Select all

echo $_GET['uct'];

Re: $_GET problem. Please help?

Posted: Thu Mar 26, 2009 7:21 pm
by UCC_Achilles

Code: Select all

 
<html>
<head>
<title>Untitled Document</title>
</head>
 
<body>
 
<?php
$uct = 'Hello, welcome to the home page';
$services = 'Our services include the following';
$portfolio = 'portfolio is the following';
$resources = 'resources are Here!';
$about = 'This is what we about.';
$contact = 'check it if u wanna contact';
 
?>
 
<?php
 
echo '<a href="index.php?uct=home">Index | </a>';
echo '<a href="index.php?uct=services">Services | </a>';
echo '<a href="index.php?uct=portfolio">Portfolio | </a>';
echo '<a href="index.php?uct=resources">Resources | </a>';
echo '<a href="index.php?uct=about">About | </a>';
echo "<a href='index.php?uct=contact'>Contact | </a>";
 
?>
 
<?php
 
echo $_GET['uct'];
 
?>
 
</body>
</html>
Not working. Anyone else? :S

Re: $_GET problem. Please help?

Posted: Thu Mar 26, 2009 8:06 pm
by Christopher
First, you're welcome. Second, yes it does now correctly echo the parameter 'uct' -- unless this page is not named index.php. Third, you really did not ask a question or specify a problem. Forth, the big red letters just make you look bad.

Re: $_GET problem. Please help?

Posted: Thu Mar 26, 2009 9:25 pm
by tech603
The only time that will display is if the url has the ?uct= parameters otherwise you wont get anything other then maybe an error on your page because you are trying to echo something that has not yet been defined.

You should really be doing something like this instead,

<?php

if(isset($_GET['uct'])){
echo $_GET['uct'];
}

?>

The above will only echo that if it actually exists.

Hope that helps.