Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jul 2007
    Location
    Scotland
    Posts
    134
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Trying to grab a GET

    Hi Guys,

    this is a small portion of the code im having trouble with:

    PHP Code:
                    </tr>
                    <tr>
                    <td align="right" /><b>Upload File</b></td><td align="left"><input type="file" name="file"><form method="get" action="uploadsneeded">
                                                                                                              <select name="uploadsneeded">
                                                                                                              <option value="2">2</option>
                                                                                                              <option value="3">3</option>            
                                                                                                              </select>
                                                                                                              <input type="submit" name="action" value="Go!">
                                                                                                              </form>
                    </td>
                    </tr>';
    ?>
    <?php
    ## how many uploads needed ##############################################################
    if($_GET['action'] == 'uploadsneeded') {

    echo 
    'uploads code here!';
    exit;

    }
    ?>
    there is a drop down box which has the value 2 or 3, this dictates how many files the user wants to upload, but im having trouble , after the Go! button is pressed i was trying to get the GET action below to catch the code but its not doing it, can anyone see where i have went wrong?

    thanks guys

    Graham

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    PHP Code:
    <form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    <input type="file" name="file">
    <select name="uploadsneeded">
    <option value="2">2</option>
    <option value="3">3</option>                                                                                                 </select>
    <input type="submit" name="submit" value="Go!">
    </form>
    PHP Code:

    if(isset($_GET['uploadsneeded'])){
    upload code

    Last edited by Nightfire; 08-25-2007 at 01:39 PM.

  • #3
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,861
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Change if($_GET['action'] == 'uploadsneeded')
    to

    if($_GET['uploadsneeded']=="2")
    {
    //
    }
    elseif($_GET['uploadsneeded']=="3")
    {
    //
    }

    The value of the select will be the value of the selected option.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #4
    Regular Coder
    Join Date
    Jul 2007
    Location
    Scotland
    Posts
    134
    Thanks
    12
    Thanked 0 Times in 0 Posts
    thanks a ton guys works great.

    Graham


  •  

    Posting Permissions

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