You are here: Code problem: Form will only work under GET method « PHP Programming Language « IT news, forums, messages
Code problem: Form will only work under GET method

Posted by bruno_guedesav on 11/19/07 18:29

This has ocurred before, but if the person had find a way to solve it
or not, I've got no clue. So, here I am to ask for help.

I've created a form via pure PHP, basically a bunch of prints together
making a form. But somthing strange goes on: the form will only pass
it's fields forward under method GET, but not on POST.

Here's a snippet of code, just the basics:

print "<form name=\"postcomment\" action=\"".HTTP_ROOT."/pages/
comment.php\" method=\"POST\">\n";
print "Nome:<br/><input type=\"text\" name=\"nome\" size=\"64\" /><br /
>";
print "Email(obrigatório; não será publicado):<br/><input type=\"text
\" name=\"email\" size=\"64\" /><br />";
print "Site:<br/><input type=\"text\" name=\"url\" size=\"64\" /><br /
>";
(...)
print "</form>\n";

This is the code that creates the form. The target page has this code
in it:

//print_pre is a function that prints "<pre>".print_r(var,true)."</
pre>", for debugging
print_pre($_POST);
print_pre($_GET);
print_pre($_REQUEST);

When method is POST, here's what I get:

Array
(
)
Array
(
)
Array
(
)

But when method is GET, this comes instead:

Array
(
)
Array
(
[nome] => Bruno Guedes
[email] => bruno_guedesav%40yahoo.com.br
[url] => about%3Ablank
(...) //There are more fields, but they aren't important
)
Array
(
[nome] => Bruno Guedes
[email] => bruno_guedesav%40yahoo.com.br
[url] => about%3Ablank
(...) //Again, there *are* mroe fields, but they don't matter
[PHPSESSID] => 09772a2105568a91612fdd33d49d8212
)

So, sorry for the long post, but what's the big deal, anybody knows?

 

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

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