Reply to Re: Is it possible to handle form submission in the same file?

Your name:

Reply:


Posted by webmasterATflymagnetic.com on 01/24/08 00:38

Ok, shortly after posting this I've got my answer (ie code that
works). The only change I've made to the above is to replace

if ($submit) {

with

if(isset($_POST['submit'])) {

and it now works! So please ignore this request.

<html>
<body>
<?php
if(isset($_POST['submit'])) {
// process form
while (list($name, $value) = each($HTTP_POST_VARS)) {
echo "$name = $value<br>\n";
}
}else{
// display form
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
First name:<input type="Text" name="first"><br>
Last name:<input type="Text" name="last"><br>
Address:<input type="Text" name="address"><br>
Position:<input type="Text" name="position"><br>
<input type="Submit" name="submit" value="Enter information">
</form>
<?php
} // end if
?>
</body>
</html>

[Back to original 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

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