0

I have this simple form:

<form method="post" action".">
<input type="text" name="title">
<input type="submit" name"send">
</form>

I want that when a user click on submit, then will be open another window of browser with the results. Is it possible?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
xRobot
  • 25,579
  • 69
  • 184
  • 304
  • dup of http://stackoverflow.com/questions/178964/javascript-post-on-form-submit-open-a-new-window – Artefacto May 17 '10 at 10:51
  • @Artefacto: Not really, that question is using Javascript to do the post. Although the question is tagged Javacript, I think it's just a normal form submission (@xRobot: Right?). – T.J. Crowder May 17 '10 at 10:53
  • You don't need Javascript for this at all (see andr's answer). Did you have a reason you actively *wanted* to use Javascript for this, rather than a built-in mechanism? Or did you just not know there *was* a built-in mechanism? – T.J. Crowder May 17 '10 at 10:54
  • Fair enough. The accepted answer provides a non-javascript mechanism (the one andr gave) though. – Artefacto May 17 '10 at 11:14

2 Answers2

2

If you just need to open a new window:

<form method="post" action="..." target="_blank">
...

If you want a popup or lightbox or anything scripty:

<form method="post" action="..." onsubmit="yourFunction()">
Andrew
  • 1,203
  • 8
  • 12
1

Use this

<form method="post" action"thepagetodisplay.php">
<input type="text" name="title" id="title">
<input type="submit" name"send">
</form>

on thepagetodisplay.php

extract($_POST);
echo $title;
Starx
  • 77,474
  • 47
  • 185
  • 261