www.webdeveloper.com
Results 1 to 7 of 7

Thread: [RESOLVED] why couldnt i just be happy surfin for porn???

  1. #1
    Join Date
    Mar 2005
    Posts
    29

    resolved [RESOLVED] why couldnt i just be happy surfin for porn???

    hey guys next problem here is checkin to make sure the required fields are filled in. it works to a point if there is missing info it gives you the right error and bands2.php but if all the fields are filled in it just gives you band2.php all filled in with the info and stops the rest of the script from exicuting
    PHP Code:
        //********BEGIN ERROR HANDLing***********
    if((!$bandname) || (!$password) || (!$emailaddy) || (!$bio) || (!$genre) || (!$photo) || (!$song))
      if(!
    $bandname) {
        echo 
    "<center><font size='4' color='red'>Band name is needed!</font><center>";
        }
          if(!
    $password) {
        echo 
    "<center><font size='4' color='red'>Password is needed!</font><center>";
        }
          if(!
    $bio) {
        echo 
    "<center><font size='4' color='red'>Tell us about yourself!</font><center>";
        }
          if(!
    $genre) {
        echo 
    "<center><font size='4' color='red'>What type of music do you play!</font><center>";
        }
          if(!
    $photo) {
        echo 
    "<center><font size='4' color='red'>Gotta have a picture!</font><center>";
        }
          if(!
    $song) {
        echo 
    "<center><font size='4' color='red'>Music we need music!</font><center>";
        }
        {
        require(
    'bands2.php');
      exit();
      } 
    as always any and all advice is welcome
    as for the title to this thread i just sometimes wish i would have never started building websites

  2. #2
    Join Date
    Jan 2005
    Location
    Alicante (Spain)
    Posts
    7,742
    The first if statement does not have curly braces encapsulating the following block. This mean it is only applied to the the first subsequent statement.

    By the way every HTML tag you are using was deprecated in 1999.

  3. #3
    Join Date
    Jun 2006
    Posts
    384
    or use elseif if you don't like curly braces

  4. #4
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,604
    While the title was pretty clever, it would be more useful to everyone here if you'd use a meanngful title that gave us some sort of clue what your post is about.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  5. #5
    Join Date
    Jan 2005
    Location
    Alicante (Spain)
    Posts
    7,742
    Quote Originally Posted by cridley
    or use elseif if you don't like curly braces
    elseif wont work here because the require is is desired in all cases that trigger the first if statement.

  6. #6
    Join Date
    Mar 2005
    Posts
    29
    thanks guys the currly brackets fixed it

  7. #7
    Join Date
    Jun 2006
    Posts
    384
    was kidding about the braces, although

    if((!$bandname) || (!$password) || (!$emailaddy) || (!$bio) || (!$genre) || (!$photo) || (!$song))
    if(!$bandname) {
    echo "<center><font size='4' color='red'>Band name is needed!</font><center>";
    }
    elseif(!$password) {
    echo "<center><font size='4' color='red'>Password is needed!</font><center>";
    }
    elseif(!$bio) {
    echo "<center><font size='4' color='red'>Tell us about yourself!</font><center>";
    }
    elseif(!$genre) {
    echo "<center><font size='4' color='red'>What type of music do you play!</font><center>";
    }
    elseif(!$photo) {
    echo "<center><font size='4' color='red'>Gotta have a picture!</font><center>";
    }
    elseif(!$song) {
    echo "<center><font size='4' color='red'>Music we need music!</font><center>";
    }
    else{
    require('bands2.php');
    exit();
    }

    is perfectly valid. ugly, maybe, but valid.
    Anyway, still just kidding as all it needs is the braces.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles