Saturday 15 January 2011

php - If server request method post echo html doesent work -



php - If server request method post echo html doesent work -

when server observe post method echo html. why doesent work?

if($_server['request_method'] == "post"){ echo '<b>ciao</b>'; }

this should work you:

(if press get button should "from method get" , if press post button should "from method post")

but have submit form otherwise server not react! have create sure file ends .php , saved in webserver.

also should have webserver php!

php:

<?php if($_server['request_method'] == "post"){ echo '<b>from method post</b>'; } elseif($_server['request_method'] == "get"){ echo '<b>from method get</b>'; } ?>

html:

<form action="" method="post"> <input type="submit" name="submitbutton1" value="post"> </form> <form action="" method="get"> <input type="submit" name="submitbutton2" value="get"> </form>

btw error messages use:

<?php error_reporting(e_all); ini_set("display_errors", 1); ?>

php html post methods

No comments:

Post a Comment