Results 1 to 4 of 4

Thread: Help with PHP

  1. #1
    New Lounger
    Join Date
    Dec 2009
    Location
    Fairfield, CA USA
    Posts
    16
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Help with PHP

    What I want to do is select a month from a dropdown and then have a
    PDF file named SL_mmm.pdf display where mmm is the month passed from
    the dropdown. Both the *.php file and the *.htm files 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
    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 OR do I have things
    in the wrong place.

    If I try to run the php code directly from the command prompt on the server
    I get a could not open file message

    Thanks for you help 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


    TestDropDown.htm code
    <html>
    <body>
    <form method="PUT" action="PVETest.php">
    <select name="month">
    <option value="Mar">Mar</option>
    <option value="Feb">Feb</option>
    <option value="Jan">Jan</option>
    </select>
    <input type="submit" value="Send">
    </form>
    </body>
    </html>


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

  2. #2
    Star Lounger
    Join Date
    Dec 2009
    Location
    Findlay, Ohio
    Posts
    57
    Thanks
    4
    Thanked 6 Times in 6 Posts
    I display pdf's in php doing this:

    header('Content-type: application/pdf');
    header('Content-Disposition: attachment; filename="download.pdf"');
    readfile($filename);

  3. #3
    New Lounger
    Join Date
    Dec 2009
    Location
    Fairfield, CA USA
    Posts
    16
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Still want dropdown

    Quote Originally Posted by orangehat View Post
    I display pdf's in php doing this:

    header('Content-type: application/pdf');
    header('Content-Disposition: attachment; filename="download.pdf"');
    readfile($filename);
    THANKS I will use that for another place I need to do that but
    I still want the drop down to pass part of file name.

  4. #4
    Star Lounger
    Join Date
    Jul 2013
    Location
    Murphy, NC
    Posts
    64
    Thanks
    0
    Thanked 8 Times in 8 Posts
    Hi Slovey,
    I see that your original post contains

    TestDropDown.htm code
    ...
    <form method="PUT" action="PVETest.php">

    but your php script fragment is preceded by "PHPTest.php code".

    I wasn't sure if these names were literally those being used in your test environment.

    Dave

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •