PHP POST variable containing number causing 404, yet if its a string or letter it works fine

I'm having this bizzare issue in my php script that i cannot figure out at all. Essentially i have a form handler, that will include the correct template part based on a hidden value from the previous template part.

My issue is i can get it working perfectly if the variable sent from the hidden input is a letter such as 'c' or similar. However i really want to use a number, so I can make neater code by doing some math instead of a big if/else or switch/case statement.

It starts off okay, if my hidden input variable is 0 or 1 and it will load correctly. But when I use the number 2 or anything higher it is causing my page to 404, it wont even pull in the header template part, just a straight up 404.

I must point out it has nothing to do with the form action or the likes as this is set in the formhandler script, and as stated it works perfectly well if i use letters instead of numbers for my hidden input values.

Below is the code that checks the variable (an isset is checked before this btw):

if ($_POST['p'] == 2) {
    listing_prog (3);
    include( '/p3.php' );
}

and here is my hidden input code (i have tried the value in quotes and without):

<input type="hidden" name ="p" value=2>

All in all any insight would be wonderful, because as i said it works if i change the hidden input values to letters instead of numbers.

Thank you and i will try to answer ASAP,

Mike

Answers


Need Your Help

WCF RIA Services Class Library and Deployment

silverlight deployment wcf-ria-services

Following the walkthrough at http://msdn.microsoft.com/en-us/library/ee707351(v=VS.91).aspx I have a working Silverlight solution that employs a WCF RIA Services Class Library. I am now stuck on ho...

Jinja2 block nesting issue

python flask jinja2

I am using jinja2 as a template language in my project. Here is simplified templates structure:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.