PHP if & else statements

Discussion in 'Web Programming' started by Zenocyde, Feb 5, 2008.

PHP if & else statements
  1. Unread #1 - Feb 5, 2008 at 1:03 PM
  2. Zenocyde
    Referrals:
    0

    Zenocyde Guest

    PHP if & else statements

    Are there any php coders out there that can help me with this? I am working on a chat network and i am trying to setup one of the parameters. On my chat network i have a list of official rooms that can be selected from a drop down box, or you can type in the name of a created chat room in to another field. On submitting this it forwards you to the chatrooom.php file and joins the appropriate room. This is my code

    <PARAM name="Room" value="<? if (isset($_POST['created_room'])) <? echo $_POST['created_room'] ?>">

    I need to add an else statement onto the end so that if someone just left the created_field blank it just looks at the official room list. Ive tried this code

    <PARAM name="Room" value="<? if (isset($_POST['created_room'])) { echo $_POST['created_room']; } else { echo "$_POST['official_room']; } ?>"

    but it doesnt seem to work. any ideas?

    idk if you can make any sense of this post lol
     
  3. Unread #2 - Feb 5, 2008 at 3:24 PM
  4. Zenocyde
    Referrals:
    0

    Zenocyde Guest

    PHP if & else statements

    nvm ive solved it now :)
     
  5. Unread #3 - Feb 9, 2008 at 9:51 PM
  6. SidStudios
    Joined:
    Mar 14, 2007
    Posts:
    201
    Referrals:
    0
    Sythe Gold:
    0

    SidStudios Active Member

    PHP if & else statements

    You should really consider posting how you fixed it, since others would benefit from it.
     
< Very basic Pascal | Curious of what code language binder's are coded in. >

Users viewing this thread
1 guest


 
 
Adblock breaks this site