You are here: Re: Foreach element in $_POST? « PHP Programming Language « IT news, forums, messages
Re: Foreach element in $_POST?

Posted by ninjadev on 12/08/05 09:19

fun with forms... iterate_form() not only spits out the values, but
will give you the $var = $_POST['var'] code for the receiving page...
have fun

function iterate_form()
{
echo "<b>Values:</b><br>";
foreach($_POST as $key => $value)
{
echo $key . " = " . $value . "<br>";
}
echo "<br><br><b>Happy Coding:</b><br>";
foreach($_POST as $key => $value)
{
echo "$". $key . " = \$_POST['". $key . "'];<br>";
}
build_back_form();
exit;
}

function build_back_form()
{
echo "<form name='error' method='post' action='".
$_SERVER['HTTP_REFERER'] ."'>\n";
foreach ($_POST as $key => $value)
{
echo "<input type='hidden' name='" . $key . "' value='" .
$value . "'>\n";
}
echo "<input type='submit' name='submit' value='Go
Back'></form>\n";
}

 

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

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