urlencode()???

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
marto_4
Forum Newbie
Posts: 4
Joined: Fri Feb 08, 2008 2:52 pm

urlencode()???

Post by marto_4 »

Where I do wrong :? :(

Code: Select all

 
<HTML>
<HEAD>
<TITLE>Input text and format it</TITLE>
</HEAD>
<BODY>
<FORM method="post" action="ganuk.php">
    <P>Input text:
        <INPUT type="text" name="ftxt">
    </P>
<?php
            //COLOR CHOICE (URLENCODE)
$color = urlencode(2);
?>  
    
    <P>
        <INPUT type="radio" name="color" value="blue"><FONT COLOR="blue" SIZE="5">Blue</FONT>
    <BR>    
        <INPUT type="radio" name="color" value="green"><FONT COLOR="green" SIZE="5">Green</FONT>
    <BR>    
        <INPUT type="radio" name="color" value="red"><FONT COLOR="red" SIZE="5">Green</FONT>
    </P>
    
    <P>
        <INPUT type="submit" name="submit" value="Format">
    </P>
</FORM>
<?php
if(color == blue) $color==urlencode("blue");
if(color == green) $color==urlencode("green");
if(color == red) $color==urlencode("red");
?>
</BODY>
</HTML>
 
scriptah
Forum Commoner
Posts: 27
Joined: Sat Mar 15, 2008 8:58 pm
Location: Long Island, NY

Re: urlencode()???

Post by scriptah »

Hello,

I think it would help us if you could explain in a couple of words what problem are you having.
Not anyone wants to open up an editor, paste & run your code.

Code: Select all

 
if(color == blue) $color==urlencode("blue");
if(color == green) $color==urlencode("green");
if(color == red) $color==urlencode("red");
 
Why the first color you're referencing to it without $?
I mean, it doesn't look like a constant.

Now you're using the == operator to assign a value.
The == operator is for comparison only, not for assigning, you mean to use =.
So for example, $color == urlencode( "blue" ) becomes $color = urlencode( "blue" ).

Fix those small stuff, then explain to us what problem you're still having.
User avatar
marto_4
Forum Newbie
Posts: 4
Joined: Fri Feb 08, 2008 2:52 pm

Re: urlencode()???

Post by marto_4 »

Hmm... That's not good. It seems like I didn't remember nothing from the book :(
I'll start from easier programing... sry for the post
Thanks a lot scriptah for the explanation!
Post Reply