php - HTML - method POST in form does not send data in phpstorm -
this question has answer here:
i have issue form doesn't send data post
method sends get
method. here html code of form
<form action="action.php" method="post"> <input type="text" name="text"> <input type="submit" value="send"> </form>
and here php code in action page
if($_server['request_method'] == 'post'){ echo $_post['text']; var_dump($_post); } if(isset($_post['text'])){ echo "ok"; }else{ echo "no"; }
when submit form error output
notice: undefined index: text in f:\test\action.php on line 9
array(0) { } no
but when send data get
method works correctly without problem. i think problem phpstorm because runs correctly in xampp server. , considerable thing when run in mozila or ie says page not found
xampp okay.
try using isset input so:
you have add name="something"
isset pick have clicked it.
<?php if (isset($_post['sub'])) { echo $_post['text']; } ?> <form action="" method="post"> <input type="text" name="text"> <input type="submit" name="sub" value="submit"> </form
Comments
Post a Comment