| | |
Button to send POST data
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Apr 2008
Posts: 500
Reputation:
Solved Threads: 0
Hi,
Button below opens new popup window but doesn't send POST data from form. How can i send POST data? I know "form action" but, i want this way.
Thanks
Button below opens new popup window but doesn't send POST data from form. How can i send POST data? I know "form action" but, i want this way.
Thanks
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<input type="submit" name="buttonUnit" value="Add" onClick="window.open('add.php','Done','width=400, height=130')">
•
•
•
•
Hi,
Button below opens new popup window but doesn't send POST data from form. How can i send POST data? I know "form action" but, i want this way.
Thanks
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<input type="submit" name="buttonUnit" value="Add" onClick="window.open('add.php','Done','width=400, height=130')">
Just to be clear: Do you want to post your data from the current form to add.php?
if the answer is YES, try this:
-------------------------------------------------------------------------------
<form action="add.php" onSubmit="window.open('','Done','width=400, height=130')">
<input type="submit" name="buttonUnit" value="Add">
...... etc
</form>
-------------------------------------------------------------------------------
OR
-------------------------------------------------------------------------------
<script language='JavaScript'>
function postMyForm(){
document.forms[0].action="add.php";
window.open('','Done','width=400, height=130');
}
</script>
<input type="submit" name="buttonUnit" value="Add" onClick="postMyForm();">
-------------------------------------------------------------------------------
Hope this works.
•
•
•
•
Answer is YES.
When i click on ADD button, it is going to open a popup windows (add.php) with POST data. The page has ADD button will remain same in the background. Your code opens popup without POST data and other page changes.
The solution below may not be exactly what you wanted/ needed ... I am sure you will get your answer.
For this I create 3 files viz. index.php(the Base Page), add.php and an intermediate page framePage.php.
Code for index.php:
<body>
<form action="add.php" method="post" target="newForm" onSubmit="window.open('framePage.php','Done','width=400, height=130')">
<input type="input" name="inp" value="Posted Data"><br>
<input type="submit" name="buttonUnit" value="Add [For Post]">
...... etc<br>
<br>
<input type="button" name="button2" value="Add [For Get]" onClick = "window.open('add.php?datafrombasepage=GetData','Done','width=400, height=130')">
You will not get Post values using this.
</form>
</body>
Code for add.php:
<body>
Post Value: <?php echo $_POST['inp']; ?><br>
Get Value: <?php echo $_GET['datafrombasepage']; ?>
</body>
Code for framePage.php:
<body>
<iframe name="newForm" src="add.php"></iframe>
</body>
the main points involved in posting data from one window to another are :<form target="newForm" (..name of the frame where to post data)>
AND
<iframe name="newform">
Hope you find your answer here. Sorry for the mistake in the previous reply.
Regards,
Sasanka.
Last edited by sasankasekhar; Nov 10th, 2008 at 11:03 am.
IF SOMEONE FEELS THAT THEY HAD NEVER MADE A MISTAKE IN THEIR LIFE, THEN IT MEANS THEY HAD NEVER TRIED A NEW THING IN THEIR LIFE
![]() |
Similar Threads
- submit button (JavaScript / DHTML / AJAX)
- data approval and delete (PHP)
- i want to post data with screen scrap page.. (ASP.NET)
- VB6 submit button sends information to BBChat (Visual Basic 4 / 5 / 6)
- Perl/CGI (Reading Data) Part II (Computer Science)
- php wont submit data into the database (PHP)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: JS variable inside HTML
- Next Thread: 'document.getElementById(...)' is null or not an object.
| Thread Tools | Search this Thread |
Tag cloud for JavaScript / DHTML / AJAX
acid2 ajax ajaxcode ajaxhelp animate api automatically beta box browser bug calendar captchaformproblem checkbox child class column cookies createrange() css cursor decimal dependent design disablefirebug dom download dropdown editor element engine error events explorer ext file firehose form forms google gwt html htmlform ie8 iframe image() images index internet java javascript jawascriptruntimeerror jquery jsf jsfile jump listbox math matrixcaptcha microsoft mimic mp4 object onmouseoutdivproblem onmouseover onreadystatechange parent pdf php player post problem progressbar rated rating regex runtime scroll search select session shopping size sql star starrating stars text textarea twitter validation w3c web website window windowofwords windowsxp wysiwyg xml \n





