Wednesday, September 25, 2013

Submit Query without Pass Query String in Pop Window

 1)make a search button on your web page  and define  type = submit
2)onclick of that button do the following:
// create the pop-up window
// make sure you give it a name
window.open("g.php", "targetSearchResult",
"width=400,height=300");
// adjust your forms target and action as:
mysearchform.target = 'targetSearchResult';
mysearchform.action = 'g.php';
mysearchform.submit();
That way, you have pre-created a pop-up window ; later you
submitted the search queries (via POST/GET method if you don't want queries)

Please Below code using solving Submit Query without Pass Query String.  in Pop Window

File save any name . for EX.  abc.html
<!DOCTYPE html>
<html>
<head>

<script language="javascript">
function doTheSubmit()
{
//document.mysearchform.theField.value='5';
mysearchform.target = 'targetSearchResult';
mysearchform.action = 'g.php';
mysearchform.submit();
}
</script>
<meta charset=utf-8 />
<title>Submit Query without Pass Query String</title>

</head>
<body>
  <form id="mysearchform" name="mysearchform" method="POST" onSubmit="doTheSubmit();">
  <input type="hidden" id="theField" name="theField" value="6">
    <br><input type="submit" value="Send" onclick="window.open('g.php','targetSearchResult','height=400,width=400');">

  </form>
</body>
</html>

.............................
Another File g.php
<?php
print_r($_POST);
echo $_REQUEST['theField'];
?>

No comments:

Post a Comment