Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 498
  • Last Modified:

How to open a new page when button is clicked.

Hi there. I need to know how to open a new page (with a variable passed) when a button is clicked. This button is not the main submit button on the form.
0
AntonBotes
Asked:
AntonBotes
2 Solutions
 
lozlozCommented:
hi,

this just involves some simple javascript. in the head:

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function openwindow() {
  window.open('yourpage.html','mywindow','toolbar=yes,status=yes,scrollbars=yes,location=yes,menubar=yes,directories=yes,width=640,height=480')
}
// End -->
</SCRIPT>

and for the button:

<input type="button" value="Open new window" name="open" onClick="openwindow(this.form)">

loz
0
 
show_sourceCommented:
Or just

<?php
echo"<form>";
echo"<input type=\"button\" onclick=\"window.open('testpage.php?var=newvar');return false\" value=\"open\">";
echo"</form>";
?>
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now