hey guys i have a problem with this code this code dont runnig, why? <?php if ($_POST['_submit_check']) { print "Hello, "; print $_POST['my_name']; } else { print <<<_HTML_ <form method="post" action="$_SERVER[PHP_SELF]" > Your name: <input type="text" name="my_name" /> <br /> <input type="submit" value="Say Hello" /> <input type="hidden" name="_submit_check" value="1" /> </form> _HTML_; } ?> PHP:
Hello, why dont you try simple html display in php instead of using heredoc syntax. like if ($_POST['_submit_check']) { print "Hello, "; print $_POST['my_name']; } else { print '<form method="post" action="$_SERVER[PHP_SELF]" > Your name: <input type="text" name="my_name" /> <br /> <input type="submit" value="Say Hello" /> <input type="hidden" name="_submit_check" value="1" /> </form>'; Code (markup): Regards,
In front. space_HTML_; Because the $_SERVER variable is between single quotes. if ($_POST['_submit_check']) { print "Hello, "; print $_POST['my_name']; } else { print '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" > Your name: <input type="text" name="my_name" /> <br /> <input type="submit" value="Say Hello" /> <input type="hidden" name="_submit_check" value="1" /> </form>'; PHP: