Php does not read POST data

Asked

Viewed 383 times

0

I created a form that will be submitted via Jquery, more specifically: http://malsup.com/jquery/form/.

Well, send the form, the php file is recognized, it returns the error messages and everything else, the problem is that it does not recognize the data received via POST. Follows the codes:

Jquery:

function editProfile(){
$("#edit-profile").ajaxSubmit({
    url: "/ajax/edit_user_profile.php",
    success: function(result){
        $("#result").html(result);
        if(result['error'] == false){
            $("#result").html("Salvo com sucesso!");
        }
        else{
            $("#result").html(result['msg_error']);
        }
    },
    beforeSend: function(result){
        if(result['error'] == true){
            $("#result").html(result['msg_error']);
        }
    },
    error: function(e){
        $("#result").html("Error!");
    },
    type: "POST"
});
}

Summary of the form (HTML):

<form id="edit-profile" method="POST">
        <!--Nome e sobrenome-->
        <label class="form">
            <b>Nome</b>
            <input type="text" class="input text" placeholder="Nome..." name="name" maxlength="255" value="<?php echo $user['name'] ?>" required>
        </label>
...

I put the isset($_POST) and he recognizes, but the isset($_POST['name']), for example, he does not recognize.

Does anyone know what might be wrong? I made two forms with a structure virtually identical to this one recently, and it was first...

  • Add id="name" to the input, to see

  • Didn’t work :(

  • Run a test, put id="name" name="name" just to see

  • I did just that

  • And nothing tbm????/

  • Nothing, he recognizes that there is POST, but not the form....

  • 1

    probably sending empty.. use browser debug console. On Chrome, press CTRL+SHIFT+I and go to the Network tab. Look for the request part so you can make sure which data is being sent..

  • Really, you’re not sending the data, how do I resolve it? I think it’s in HTML,...

  • I found out, it was such a silly hahaha thing. The modal that opened the form had the same form id...

Show 4 more comments

1 answer

-1

Hello,

In the part where you are using Method="POST", test using minuscule letters as method="post"

Big hug and hope it works.

  • Luis, thank you for your answer. But I don’t think that’s it...

Browser other questions tagged

You are not signed in. Login or sign up in order to post.