I'm trying to submit a form with jquery from plugin With multiple submits, but i can't get the value from the $_POST['aggInf'] in php, i can get it in js.
My form:
<form action="#" method="post" id="gestioneProfilo">
My inputs:
<input name="aggInf" type="submit" value="Upload" class="upload">
 <input name="aggInfAnn" type="submit" value="Annulla" id="cancel">
If i try onsubmit='alert($(this).serialize()); return false;' on the from i always get this in return:
On the js side i used this solution and it works fine, if i try a console.log() command i get the correct value.
If i try a var_dump() command i only get all the other input and textboxes values. How do i fix this?
Full form html:
    <form action="#" method="post" id="gestioneProfilo">
        <!-- Scelta avatar -->
        <div id="sceltaAvatar">
            <!-- Profilo -->
            <div id="perAvatar">
                <h1>Scelta dell'Avatar</h1>
                <p>Carica dal tuo pc o dal web una tua immagine di profilo</p>
                <!-- <input type="hidden" name="immP"> -->
            </div>
            <!-- Copertina -->
            <div id="perCopertina">
                <h1>Scelta della copertina</h1>
                <p>Carica dal tuo pc o dal web una tua immagine di copertina</p>
                <!-- <input type="hidden" name="immC"> -->
            </div>
            <!-- Info generali -->
            <div id="altreInfo">
                <div>
                    <!-- informazioni -->
                    <h1>Informazioni</h1>
                    <textarea placeholder="Cosa fai nella vita? Scrivi una breve descrizione su di te" name="bio" id="bio"><?php get_stuff('bio', TRUE, TRUE) ?></textarea>
                </div>
                <div id="due">
                    <div>
                        <!-- Sito -->
                        <h1>Sito</h1>
                        <textarea placeholder="Il tuo sito" name="sito" id="sito"><?php get_stuff('sito', TRUE, TRUE) ?></textarea>
                    </div>
                    <div>
                        <!-- Posizione -->
                        <h1>Posizione</h1>
                        <textarea placeholder="Da dove vieni?" name="pos" id="pos"><?php get_stuff('pos', TRUE, TRUE) ?></textarea>
                    </div>
                </div>
            </div>
            <!-- Torna indietro -->
            <input name="aggInf" type="submit" value="Upload" class="upload">
            <input name="aggInfAnn" type="submit" value="Annulla" id="cancel">
        </div>
    </form>
    <?php include_once 'lightbox.php' ?>
js:
$('#gestioneProfilo').submit(function(e) {
    e.preventDefault();
    var
        val = $("input[type=submit][clicked=true]").val(),
        pop = $(this);
    console.log(val);
    // it works, if i press upload it prints upload, if i press annulla it prints annulla
    if (val == "Upload") {
        $(this).ajaxSubmit({
            type: 'POST',
            url: "lib/ajax.php",
            dataType: "json",
            data: pop.serialize(),
            success: function(data){
                //stuff
            }
        });
    }else{
        cambiaA("#perCommentare", "#gestioneProfilo", "ritorna");
    };
});
$(document).on('click', '#gestioneProfilo input[type=submit]', function() {
    $("input[type=submit]",
    $(this).parents("#gestioneProfilo")).removeAttr("clicked");
    $(this).attr("clicked", "true");
});
php:
if (isset($_POST['aggInf'])) {
    update_info();
    $return_data['immP'] = get_stuff('immP');
    $return_data['immC'] = get_stuff('immC');
    $return_data['bio']  = get_stuff('bio');
    $return_data['sito'] = get_stuff('sito', FALSE, TRUE);
    $return_data['pos']  = get_stuff('pos');
    echo json_encode($return_data);
    exit;
}

 
    