How to open a new page when button is clicked.

Posted on 2003-11-20
Last Modified: 2008-03-06
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.
Question by:AntonBotes
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 13

Accepted Solution

lozloz earned 25 total points
ID: 9786766

this just involves some simple javascript. in the head:

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

and for the button:

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


Assisted Solution

show_source earned 25 total points
ID: 9787295
Or just

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

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

634 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question