count($_REQUEST) returning wrong parameters

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kgtrm
Forum Newbie
Posts: 3
Joined: Sat Feb 19, 2011 7:07 am

count($_REQUEST) returning wrong parameters

Post by kgtrm »

Sir,when i used count($_REQUEST) to count the number of parameters that the page has received,sometimes i am getting correct values , but sometimes i am getting wrong values.If the parameters are 4,sometimes i am getting as 4,but sometimes i am getting as 5.What can be the reason? I checked with different browsers,but i got problem with both browsers.Means,its not browser fault.Please solve this.
Thankyou.
kgtrm
Forum Newbie
Posts: 3
Joined: Sat Feb 19, 2011 7:07 am

Re: count($_REQUEST) returning wrong parameters

Post by kgtrm »

i found the reason sir,but i need solution for this.
Reason is,i am having a contact.php in my website. And,all these parameters are related to index.php
When i open contact.php,the parameters count to index.php is being increased by one.But if i see the URL,it contains only correct number of parameters.
If i dont open contact.php,and if i just use index.php,the parameters count is correct.Getting problem only when i open contact.php.
What is the solution for this.
Thankyou.
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

Re: count($_REQUEST) returning wrong parameters

Post by Darhazer »

$_REQUEST contains all parameters from $_GET, $_POST and $_COOKIE
if you are using $_POST method for your forms, use count($_POST)
kgtrm
Forum Newbie
Posts: 3
Joined: Sat Feb 19, 2011 7:07 am

Re: count($_REQUEST) returning wrong parameters

Post by kgtrm »

thanks a lot...i will try that..
Post Reply