action form problem

Discussion in 'PHP' started by bumbar, Sep 15, 2009.

  1. #1
    Hallo!

    I have a simple form with one text field.

    action attribute is "index.php?menu=search". when clicked submit, however, the form is sent without parameters 'menu = search'. Ie action is "index.php?val=sometext". What disappeared from the URL 'menu=search'. How can I fix this??

    
    <form method="get" action="index.php?menu=search">
    <input type="text" name="val">
    </form>
    
    HTML:
    How do I make URL to index.php?menu=search&val=sometext ??

    Thanx!
     
    bumbar, Sep 15, 2009 IP
  2. mdrobiul

    mdrobiul Peon

    Messages:
    186
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    when you are using get method, all values automatically will be added to url. but i'm not sure about "menu = search"

    rather you can take an input hidden field called 'menu' and with value 'search' and finally you get your desired url index.php?menu=search&val=sometext

    you must use get method
     
    mdrobiul, Sep 15, 2009 IP
  3. mdrobiul

    mdrobiul Peon

    Messages:
    186
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    <form method="get" action="index.php">
    <input type="text" name="val">
    <input type="hidden" name="menu" value="search">
    </form>
     
    mdrobiul, Sep 15, 2009 IP
  4. bumbar

    bumbar Active Member

    Messages:
    68
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #4
    really very clever. Problem is solved.
    Thank you!
     
    bumbar, Sep 15, 2009 IP