LiveWire Network Peer Answers Peer Support Teen Forums Tech Forums College Forums 578 users online 225386 members 864 active today Advertise Here Sign In
TeenCollegeTechPhotos | Quizzes | LiveSecret | Memberlist | Dictionary | News | FAQ
Member Spotlight
Live Just To Die
Favs: DevilDriver, Dillinger Escape Plan, Dist...
Mood: Lonely
You have 1 new message.
Emergency Help
Until you sign up you can't do much. Yes, it's free.

Sign Up Now
Membername:
Password:
Already have an account?
Invite Friends
Active Members
Groups
Contests
Moderators
8 online / 15 MPM
Fresh Topics
  LiveWire / Technical Forums / Programming & Application Development / Adding Reply

Quoting Post
Archived Topic: It will not be bumped to the top of the forum.
Topic PHP basic help.
Membername   Not a member? Sign Up Free (takes 20 seconds)
Password   Forgotten your password?
Post

Font:   Size:   Color:

FAQ Keyword Search:
Post Options
Favorites Manager
Notify me of new replies to this topic by email
Notify me of new replies to this topic by private message
Original Post
RossTheHoss69 Posted at 7:06 pm on Aug. 13, 2007
Okay, here's the first code:
Code:

<html>
<body>
<form action="yoo.php" method="get">
<input type="radio" name="color" value="1">Red Style.
<input type="radio" name="color" value="2">Blue Style.
<input type="radio" name="color" value="3">Yellow Style.
<input type="submit" value="submit." />
</form>
</body>
</html>

and here's the action page:
Code:

<html>
<body>
<?php
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.

Replies
RossTheHoss69 Posted 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.
Macropiper Posted 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']
The Dalai Lama Posted at 7:14 pm on Aug. 13, 2007
Yeah, plus you forget the { } for the If command.
RossTheHoss69 Posted at 7:13 pm on Aug. 13, 2007
Quote: from The Dalai Lama at 9:09 pm on Aug. 13, 2007

Code:

<html>  
<body>  
<?php  
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.
The Dalai Lama Posted at 7:09 pm on Aug. 13, 2007
Code:

<html>  
<body>  
<?php  
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.

All 5 previous replies displayed.