# Help with PHP problem

**URL:** <https://www.phphelp.com/t/help-with-php-problem/24290>\
**Category:** Security and PHP\
**Created:** [May 27, 2015, 10:21pm UTC](https://www.phphelp.com/t/help-with-php-problem/24290 "2015-05-27T22:21:30Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![slovey](https://www.phphelp.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@slovey](https://www.phphelp.com/u/slovey)\
**Post date:** [May 27, 2015, 10:21pm UTC](https://www.phphelp.com/t/help-with-php-problem/24290/1 "2015-05-27T22:21:30Z")

</div>

What I want to do is select a month and then have a PDF file names SL\_mmm.pdf display  
where mmm is the month passed from the dropdown. Both the \*.php file and the \*.htm file  
are in the same directory with the PDF file in a subdirectory under that.

What is happening is on the htm page I am picking Feb and hitting Go, then  
the browser shows website/PVETest.php?month=Feb  
Then I get page not found 404 error but it is there.  
It is like the htm page is not really getting to the PHP file.

Thanks in advance

Environment:

Software loaded and verified  
Win Server 2003  
IIS 6.0  
PHP 5.4  
VC9 x86  
FastCGI  
WinCache 1.3  
Visual C++ Redistributable files for X86

PHP has been tested and works from command prompt  
All FastCGI changes have been made per documentation

HTML code

Mar Feb Jan

PHPTest.php code

\<?php // The URL of the form page. The PHP script // redirects to it if someone loads the script // directly without submitting the form properly. $url='href:/PVEHomeTest.htm'; if(isset($\_POST['month'])) { // should return a URL like "http://foo.com/Mar.pdf". $url='http://www.loventhal.com/Public/SL'.$\_POST['month'].'.pdf'; } header("Location:$url"); exit; ?\>
* * *

[Posting.txt](https://www.phphelp.com/uploads/default/original/2X/f/fd8d12a3f0684de208d4f6272b7a724d533fd2d3.txt) (3.34 KB)

---

<div class="post-metadata">

**Author:** ![benanamen](https://www.phphelp.com/user_avatar/www.phphelp.com/benanamen/32/287_2.png) [@benanamen](https://www.phphelp.com/u/benanamen)\
**Post date:** [May 27, 2015, 11:46pm UTC](https://www.phphelp.com/t/help-with-php-problem/24290/2 "2015-05-27T23:46:12Z")

</div>

You have an error here:

\<form method="[b]PUT[/b]" 

Should be

\<form method="post" 

Also, you have no values for your months dropdown

Mar

Should be

Mar

---

<div class="post-metadata">

**Author:** ![slovey](https://www.phphelp.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@slovey](https://www.phphelp.com/u/slovey)\
**Post date:** [June 2, 2015, 7:49pm UTC](https://www.phphelp.com/t/help-with-php-problem/24290/3 "2015-06-02T19:49:05Z")

</div>

Made the changes you recommended Kevin but still not working

What is happening is on the htm page I am picking Feb and hitting Go, then  
the browser shows website/PVETest.php?month=Feb  
but I get page not found 404 error but it is there.  
It is like the htm page is not really getting to the PHP file.

TestDropDown.htm code

Mar Feb Jan

PHPTest.php code

\<?php // The URL of the form page. The PHP script // redirects to it if someone loads the script // directly without submitting the form properly. $url='href:TestDropDown.htm'; if(isset($\_PUT['month'])) { // should return a URL like "http://foo.com/Mar.pdf". $url='http://www.loventhal.com/Public/SL\_.$\_PUT['month'].pdf'; } header("Location:$url"); exit; ?\>

---

<div class="post-metadata">

**Author:** ![benanamen](https://www.phphelp.com/user_avatar/www.phphelp.com/benanamen/32/287_2.png) [@benanamen](https://www.phphelp.com/u/benanamen)\
**Post date:** [June 2, 2015, 7:50pm UTC](https://www.phphelp.com/t/help-with-php-problem/24290/4 "2015-06-02T19:50:47Z")

</div>

If that is the code, you didnt make the changes.

---

<div class="post-metadata">

**Author:** ![slovey](https://www.phphelp.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@slovey](https://www.phphelp.com/u/slovey)\
**Post date:** [June 2, 2015, 9:32pm UTC](https://www.phphelp.com/t/help-with-php-problem/24290/5 "2015-06-02T21:32:36Z")

</div>

Sorry, I pasted wrong code in. Thanks in advance for your help

Browser shows [http://loventhal.homeip.net/PVETest.php](http://loventhal.homeip.net/PVETest.php) then  
I now get a 405 invalid method used message (HTTP verb)

here is my current code

Mar Feb Jan

PVETest.php

\<?php // The URL of the form page. The PHP script // redirects to it if someone loads the script // directly without submitting the form properly. $url='href:TestDropDown.htm'; if(isset($\_POST['month'])) { // should return a URL like "http://foo.com/Mar.pdf". $url='http://loventhal.homeip.net/Public/SL\_.$\_POST['month'].pdf'; } header("Location:$url"); exit; ?\>

---

<div class="post-metadata">

**Author:** ![benanamen](https://www.phphelp.com/user_avatar/www.phphelp.com/benanamen/32/287_2.png) [@benanamen](https://www.phphelp.com/u/benanamen)\
**Post date:** [June 2, 2015, 10:03pm UTC](https://www.phphelp.com/t/help-with-php-problem/24290/6 "2015-06-02T22:03:18Z")

</div>

Dont use IIS Server. Microsoft sucks. Install a proper lamp stack. I personally am not interested in debugging Microsoft products. Perhaps someone else might.

---

<div class="post-metadata">

**Author:** ![Topcoder](https://www.phphelp.com/user_avatar/www.phphelp.com/topcoder/32/4356_2.png) [@Topcoder](https://www.phphelp.com/u/Topcoder)\
**Post date:** [June 3, 2015, 4:47pm UTC](https://www.phphelp.com/t/help-with-php-problem/24290/7 "2015-06-03T16:47:00Z")

</div>

You need to get off windows 2003 Server, support dies for it in 41 days…

> **[Microsoft Azure Cloud Computing Platform & Services](https://azure.microsoft.com/en-us/?ocid=cloudplat_hp)**
>
> Microsoft Azure is an open, flexible, enterprise-grade cloud computing platform. Move faster, do more, and save money with IaaS + PaaS. Try for FREE.

I don’t have a 2003 server anymore to test your code, but my guess is that in your handler mappings you’ll need to enable POST and GET Verbs.

---

<div class="post-metadata">

**Author:** ![slovey](https://www.phphelp.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@slovey](https://www.phphelp.com/u/slovey)\
**Post date:** [June 3, 2015, 10:06pm UTC](https://www.phphelp.com/t/help-with-php-problem/24290/8 "2015-06-03T22:06:14Z")

</div>

Topcoder,

I really appreciate your help. I will be converting to a new operating system in the next month or so - going to linux and apache. But in the mean time, I was trying to get this going.

I have a handler mapping set up for .php to tie to php5.dll. Still no progress.

My directory structure is  
c:  
Inetpub  
PHP  
wwwroot - contains html  
Public - PDFs  
is that structure okay? I know my file permissions are okay for access.

when I ran from dos prompt  
c:\Inetpub\php\php.exe c:\Inetpub\wwwroot\PVETest.php  
I got a warning about a timezone issue and it said to sset date.timezone to my zone on line 10  
then an parse error, unexpected ‘month’ on line 10

does this help debug?

thanks in advance

---

<div class="post-metadata">

**Author:** ![Topcoder](https://www.phphelp.com/user_avatar/www.phphelp.com/topcoder/32/4356_2.png) [@Topcoder](https://www.phphelp.com/u/Topcoder)\
**Post date:** [June 4, 2015, 1:18pm UTC](https://www.phphelp.com/t/help-with-php-problem/24290/9 "2015-06-04T13:18:47Z")

</div>

I debugged your code, Now I’m late for work ☹

Change

[php] $url=‘[http://loventhal.homeip.net/Public/SL\_.$\_POST[‘month’].pdf](http://loventhal.homeip.net/Public/SL_.%24_POST%5B'month'%5D.pdf)’; [/php]

To

[php] $url=‘[http://loventhal.homeip.net/Public/SL\_](http://loventhal.homeip.net/Public/SL_)’ . $\_POST[‘month’] . ‘.pdf’; [/php]

You can see it working here [http://www.phphelp.com/TestDropDown.htm](http://www.phphelp.com/TestDropDown.htm)

---

<div class="post-metadata">

**Author:** ![slovey](https://www.phphelp.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@slovey](https://www.phphelp.com/u/slovey)\
**Post date:** [June 4, 2015, 8:44pm UTC](https://www.phphelp.com/t/help-with-php-problem/24290/10 "2015-06-04T20:44:12Z")

</div>

Topcoder

You are awesome. It works now. Sorry, it made you late for work.

Thanks again
