Help with PHP problem


#1

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 (3.34 KB)


#2

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

#3

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; ?>

#4

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


#5

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

Browser shows 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; ?>

#6

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


#7

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

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.


#8

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


#9

I debugged your code, Now I’m late for work :frowning:

Change

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

To

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

You can see it working here http://www.phphelp.com/TestDropDown.htm


#10

Topcoder

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

Thanks again