LiveWire Peer Support Network

Printable Version of Topic "PHP basic help."

- LiveWire Teen Forums & College Forums (http://www.golivewire.com)
-- (http://www.golivewire.com/forums/support-technical.html)
--- Programming & Application Development (http://www.golivewire.com/forums/forum-211-s-0.html)
---- PHP basic help. (http://www.golivewire.com/forums/peer-tynisb-support-a.html)


-- Posted by RossTheHoss69 at 7:06 pm on Aug. 13, 2007

Okay, here's the first code:
Code:




Red Style.
Blue Style.
Yellow Style.




and here's the action page:
Code:



echo $_GET['color'].value;
if ($_GET['color'].value="1") then
$gar="red";

elseif ($_GET['color'].value="2") then
$gar="blue";

else
$gar="yellow";

echo $gar;
?>

WTF is wrong with this?
Anytime I run the first page,
I get:
Code:

Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\yoo.php on line 5

Help?

EDIT: Fixed.


-- Posted by The Dalai Lama at 7:09 pm on Aug. 13, 2007

Code:

 
 
echo $_GET['color'].value;  
if ($_GET['color'].value == "1") {
$gar="red";
}

elseif ($_GET['color'].value == "2") {  
$gar="blue";  
}
else
{  
$gar="yellow";  
}
echo $gar;  
?>

Okay, I've edited twice.  This time should do it.


-- Posted by RossTheHoss69 at 7:13 pm on Aug. 13, 2007

Quote: from The Dalai Lama at 9:09 pm on Aug. 13, 2007


Code:

 
 
echo $_GET['color'].value;  
if ($_GET['color'].value == "1") {
$gar="red";
}

elseif ($_GET['color'].value == "2") {  
$gar="blue";  
}
else
{  
$gar="yellow";  
}
echo $gar;  
?>

Okay, I've edited twice.  This time should do it.



Yeah.
Once I got to thinking,
I forgot to add the extra "=".
I always get confused with PHP and TI-Basic.


-- Posted by The Dalai Lama at 7:14 pm on Aug. 13, 2007

Yeah, plus you forget the { } for the If command.


-- Posted by Macropiper at 1:59 pm on Aug. 14, 2007

Whats up the the $_GET['color'].value bit? PHP is not Javascript, all you need is $_GET['color']


-- Posted by RossTheHoss69 at 2:31 pm on Aug. 14, 2007

Quote: from Tangaroa at 3:59 pm on Aug. 14, 2007


Whats up the the $_GET['color'].value bit? PHP is not Javascript, all you need is $_GET['color']

I know.
I got a little confused when I was going fast...
I was in a rush to show someone something,
and I had to save my work.


www.golivewire.com