Originariamente inviato da ororo.munroe
Ciao a tutti,
questo è il mio primo post qua.

Qualcuno mi sa dire se è possibile spedire i dati di un form in parte via GET, e in parte via POST?


Grazie!

il modo ci sarebbe anche (usando solo per comodità jquery)

codice:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="it" xml:lang="it">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title></title>
        
        
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"> </script>
        
        <script type="text/javascript">
        // <![CDATA[
        
        var sendGetPars = function(form) {
            
            var action          = form.action,
                getMethodFields = $('.get', $(form)),
                len             = getMethodFields.length;
                
            if (len > 0) {
                action += '?';  
                getMethodFields.each(function(j) {
                    var i   = $(this); 
                    action += [i.attr('name'), i.val()].join('=');
                    if (j < len - 1) action += '&';  
                });
            
            }
            form.action = action;
            return true;
        }
        
        // ]]>
        </script>
    </head>

<body>


    <form action="formsend.php" method="POST" onsubmit="return sendGetPars(this)">
        
        <input type="text" name="i1" value="1" class="get" />
        <input type="text" name="i2" value="2" />
        <input type="text" name="i3" value="3" class="get" />
        <input type="text" name="i4" value="4" class="get" />
        <input type="text" name="i5" value="5" />
        
        <input type="submit" />
        
    
    </form>

</body>
</html>
basta mettere una classe (es. get) sui campi da passare anche in get
lato server però recuperali sempre in post