A
A
Aitym Ramazanov2017-06-05 07:08:31
PHP
Aitym Ramazanov, 2017-06-05 07:08:31

Why does $_POST come empty on local server?

In general, I am doing a feedback form and met with such a problem: the $_POST array comes empty on the local server (localhost). If I upload all the site files to the hosting, everything works (namely, the $_POST array is not empty). Why, I don't understand. Here is the php code:

<?php
    if (isset($_POST["send"])) {
        print_r($_POST);
    }
    require "header.php";
    $active_menu_index = 2;
    require 'main_menu.php';
?>
    <form name="feedback" action="." method="post">
        <label>От кого: </label><br />
        <input type="text" name="from" /><br />
        <label>Кому: </label><br />
        <input type="text" name="to" /><br />
        <label>Тема: </label><br />
        <input type="text" name="subject" /><br />
        <label>Сообщение: </label><br />
        <textarea name="message" cols="24" rows="10"></textarea><br />
        <input type="submit" name="send" value="Отправить" />
    </form>
<?php
    require "footer.php";
?>

Here is the result:
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Персональный сайт Рамазанова Айтыма</title>
</head>
<body>
    <header>
        <div class="container">
            <ul class="main-menu">
                <li class="current">Главная
                <li><a href="about_me.php">Обо мне</a>
                <li><a href="contact.php">Связаться со мной</a>
            </ul>
        </div>
    </header>
</body>
</html>

Here are the headers (Yandex Browser on Linux):
04171dffc9b2407ca672e5a4a8ff8c1b.png
As I understand it, $_POST is transmitted, but then cleared.
Hosting does not have this problem. Help, please
PS Everything was resolved. Launched the site through PHPStorm, which used a non-standard port. Demolished mysql phpadmin and everything else and installed it back. I made a symbolic link /var/www/html to my website directory www. And voila, everything worked.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Samarkand, 2017-06-05
@Samarkand

Do a normal action, this is an error:
action="."

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question