You are here: Re: $_SERVER['QUERY_STRING'] empty when using post? « PHP Programming Language « IT news, forums, messages
Re: $_SERVER['QUERY_STRING'] empty when using post?

Posted by ChronoFish on 10/31/08 11:32

"...So there's no better way to get the string when using post other
than
compiling it yourself?..."

What do you mean "compile it yourself". You get the QUERY_STRING - but
it happens to be blank - that's just the nature of a POST. It's not
inconveivable that your Form's "action" looks like this:
"http://somehost.com/form_handler?sentby=page1&remotesite=true"

Here your $_GET array would be comprised of:
$_GET['sentby']='page1'
$_GET['remotesite']='true'

Your Query String would be "sentby=page1&remotesite=true" and the
$_POST array would hold the contents of the form vars.

It would be pretty easy to "compile" a post's query string:

foreach ($_POST as $a => $v)
$postQueryString.= ($postQueryString=="" ? "" : "&" ) ."$a=$v";


Not sure why you'd want to do this, but there it is. BTW, the value of
QUERY_STRING is set by your web server - PHP just gives you access to
it.

-CF

 

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

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