<!doctype html> <html lang="fr"> <head> <meta charset="utf-8"> <title>Titre de la page</title> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> </head> <body> <div class="container" style="width: 200px;"> <form enctype="multipart/form-data" method="post" id="mon_form" action="#"> <div class="form-group"> <label for="param-un">Param1:</label> <input type="text" class="form-control" id="param-un" name="param[un]" value="v1"> </div> <div class="form-group"> <label for="param-deux">Param2:</label> <input type="text" class="form-control" id="param-deux" name="param[deux]" value="v2"> </div> <div class="form-group"> <label for="param-trois">Param3:</label> <input type="text" class="form-control" id="param-trois" name="param[trois]" value="v3"> </div> <button type="submit" class="btn btn-default" onclick="$.app.send();return false;">Submit</button> </form> </div> <script type="text/javascript"> //<![CDATA[ $(function() { $.app = { url: '', send: function() { //document.location = $.app.url+'?'+$('#mon_form').serialize(); window.open($.app.url+'?'+$('#mon_form').serialize(), '_blank'); } } $.app.url = "http://localhost/test/page2.php"; }); </script> </body> </html>
<pre><?php print_r($_GET['param']); ?></pre>
Modifié le 11 janv. 2020 à 09:19