Trying to get this form to post to my db with process.php and to another website using POST. Right now it will only load the second f.action. If I remove the first f.submit() it only does the first f.action. Any idea on getting this to work? I'm also trying to have "site2" open either in _self or _blank, with the information passed on to it, and all I need for process.php is for it to submit <script type="text/javascript"> <!-- function newWin(f) { f.target="_blank"; f.action="process.php?mobile_no="; f.submit() f.target="_blank"; f.actuon="secondsite" f.submit(); return true; } //--> </script> </head> <body> <div data-role="page" id="page"> <form method="POST" action="secondsite" onsubmit="newWin(this)"> <div data-role="content"> <center> <p><input type="text" id="mobile_no" name="mobile_no" placeholder="Phone Number"></p> </center> <p><input type="submit" value="Submit"></p> </div> </form> </div> would that be like this? $.post('process.php', function(data),'site2', function(data) { $('.result').html(data); }); or $.post('process.php','site2' function(mobile_no) { $('.result').html(mobile_no); }); I'm also trying to have "site2" open either in _self or _blank and all I need for process.php is for it to submit Or would I be able to add some type of forwarder into process.php? <? $mobile_no=$_POST['mobile_no']; mysql_connect("localhost", "dbuser", "dbpass) or die(mysql_error()); mysql_select_db("dbname") or die(mysql_error()); mysql_query("INSERT INTO `data` VALUES ('$mobile_no')"); Print "Your information has been successfully added to the database."; ?>
I managed to get it with this in my process.php file. and just had the form submit to it with the GET method. <?php $phone = $_GET['phone']; header("Location: http://www.site.com/?a=1k4wlay&b=1pl2isa&s1=&phone=$phone"); ?> <? $phone=$_GET['phone']; mysql_connect("localhost", "db_user", "db_pass) or die(mysql_error()); mysql_select_db("db_name") or die(mysql_error()); mysql_query("INSERT INTO `data` VALUES ('$phone')"); Print "Your information has been successfully added to the database."; ?>
If you want fire two post request in one submit i think you will need ajax request instead of normal request