You are here: Form results in popup window « PHP Programming Language « IT news, forums, messages
Form results in popup window

Posted by damezumari on 11/15/07 11:18

I created two test files:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body>
<form method="post" action="testform2.php"
onsubmit="window.open('testform2.php','popup','height=150,width=50');">
<p>First name: <input type="text" name="firstname" /></p>
<p><input type="submit" value="Go"></p>
</form>
</body>
</html>

and

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body>
<?php
echo $_POST[firstname];
?>
</body>
</html>

The idea was to open testform2.php in a window where I decided the
height and width. Instead two windows opened. testform2.php in one
window and the popup in another. The first name was printed in the
first, but not in the second.

I take this to mean that the way to achieve what I want is to use
Javascript like this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<script type="text/javascript">
function jspop()
{
var arg = "height=150,width=50";
firstname = document.getElementById('idfirstname').value;
handle = window.open("testform2.php?
firstname="+firstname,"popup",arg);
handle.focus();
}
</script>
</head>
<body>
<p>First name: <input id="idfirstname" type="text" name="firstname"></
p>
<p><input type="button" value="Go" onclick="jspop();"></p>
</body>
</html>

and

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body>
<?php
echo $_GET[firstname];
?>
</body>
</html>

Or, is there a simpler/better way? It is not very safe to pass all the
variables using parameters.

Regards,

Jan Nordgeen

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация