note 51754 added to control-structures.elseif

From: Date: Sun, 10 Apr 2005 03:44:54 +0000
Subject: note 51754 added to control-structures.elseif
Groups: php.notes 
Request: Send a blank email to php-notes+get-87772@lists.php.net to get a copy of this message
Dont make your code as jumbled up as this: if (!$username || !$password) { echo("<form method='post' action='signin.php'>"); } elseif($action == "c" || $action == "d" || $action == "e" || $action == "f" || $action == "g" || $action == "h" || $action == "i") { echo("<form method='post' action='" . findbattle() . ".php'><input type='hidden' name='strt' value='y'>"); } elseif($action == "b") { die ("Sorry, dude. You're banned from this site!"); } else { echo("<form method='post' action='game.php'>"); } It works best when you only compare related variables. ---- Manual Page -- http://www.php.net/manual/en/control-structures.elseif.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+51754 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51754&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51754&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51754&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51754&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51754&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+51754&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#87772) next »