good practice

From: Date: Thu, 14 Feb 2002 19:09:42 +0000
Subject: good practice
Groups: php.general 
Request: Send a blank email to php-general+get-84794@lists.php.net to get a copy of this message
Can someone recommend a better method for doing something like the following? All of my programs are written like this, but it's really poor form considering I'm not predeclaring my variables, etc. Only thing I can really think of is to assign a value in the form a number like 1 or something, then do a if $value == 1 {do something} but that seems kinda hokey. Here's an example of something I'd do: <HTML><BODY> <? if ($submitdata) { dosomething; exit; } echo "<form name=\"form\" action=\"$PHP_SELF?\">\n"; echo " <input type=\"text\" name=\"data\">\n"; echo " <input type=\"submit\" name=\"submitdata\" value=\" Submit \">\n"; echo "</form>\n</body>\n</html>"; ?>

« previous php.general (#84794) next »