M7md0136466
M7md0136466

Reputation: 59

php $_POST does not work and I get empty result

I searched the other posts but non of the answers worked.
I tried to use $_REQUEST instead of $_POST, I tried to use if(isset($_POST['submit']) , I checked php.ini file and globals were enabled, I was using wamp server and I swiched between version 5 and 7, I removed wamp and Installed xampp but the result was the same (the result is empty page).

My code:

<form action="inbox.php?do=submit" method="post">
         <textarea name="sublinks" id="sublinks"></textarea>
        <input type="submit" value = "senď" />
</form>

<?
if($_GET['do'] == 'submit')
{
        echo $_POST['sublinks'];
}
?>

Edit: I tried this code and it works but I need to solve the problem Why echo $_POST not working

<?
    if($_GET['do'] == 'submit')
    {
    ?>
         <?=$_POST['links'];?>
    <?
    }
?>

Upvotes: 0

Views: 52

Answers (1)

M7md0136466
M7md0136466

Reputation: 59

I added php to <? and it works now, Thanks everyone :)

<?php
if($_GET['do'] == 'submit')
{
        echo $_POST['sublinks'];
}
?>

Upvotes: 1

Related Questions