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
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
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 …

813 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now