Well, for instance. I don't like forms that submit to the same page where it is located. Separating them helps to maintain the code (usually). I don't like html inside <?php so 99% of the times I escape with ?>.
Btw, you should start with <?php and not <?. Your input is missing the /, newer versions of HTML (or XHTML) recommend to finish tags that explicitily don't have a finishing term, with /. So it's: <input type="text" name="data" /> And if $submitdata is expected to come from a form, check it: if ($_SERVER['HTTP_REFERER'] == 'somepage.php') { if (isset($_POST['submitdata'])) { dosomething; } } I also don't like to exit(); programs, but I don't know your whole situation, so your mileage may vary.... And sometimes use a } else { on expected values with some nasty error messages (just in case someone is trying to 'crack' your app). -- Julio Nobrega. Um dia eu chego lá: http://sourceforge.net/projects/toca Ajudei? Salvei? Que tal um presentinho? http://www.submarino.com.br/wishlistclient.asp?wlid=664176742884 "James Taylor" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > 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>"; > > ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php