Results 1 to 3 of 3

Thread: PHP Hidden value

  1. #1
    Join Date
    Feb 2009
    Posts
    62
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default PHP Hidden value

    Ok so I want to take this code.

    PHP Code:
    <form action="http://kywordpro.com/redirect.php" method="get" class="style1">
    Web: <input type="radio"<?php echo ($_GET['a'] == 'txt' || !isset($_GET['a'])) ? " checked=\"checked\"" ""?> name="a" value="txt" /> | 
    Images: <input type="radio"<?php echo ($_GET['a'] == 'img') ? " checked=\"checked\"" ""?> name="a" value="img" /> | 
    Video: <input type="radio"<?php echo ($_GET['a'] == 'avi') ? " checked=\"checked\"" ""?> name="a" value="avi" /> | 
    News: <input type="radio"<?php echo ($_GET['a'] == 'news') ? " checked=\"checked\"" ""?> name="a" value="news" /> | 
    Music: <input type="radio"<?php echo ($_GET['a'] == 'mp3') ? " checked=\"checked\"" ""?> name="a" value="mp3" /><br />
    <input type="text" name="q" size="55" value="<?php echo ucwords($q .''); ?>" />
    <input type="submit" value="Search" />
    <input type='hidden' name="num" value="10"></form>

    And remove all of the seach options except for web.
    Then I want web to be hidden value.

    Can anyone help?

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    This should do it:
    HTML Code:
    <form action="http://kywordpro.com/redirect.php" method="get" class="style1"> 
    <input type="hidden" name="a" value="txt" />
    <input type="text" name="q" size="55" value="<?php echo ucwords($q .''); ?>" /> 
    <input type="submit" value="Search" /> 
    <input type='hidden' name="num" value="10"></form>
    Jeremy | jfein.net

  3. The Following User Says Thank You to Nile For This Useful Post:

    tgallagher26 (05-04-2009)

  4. #3
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    Quote Originally Posted by Nile View Post
    This should do it:
    HTML Code:
    <form action="http://kywordpro.com/redirect.php" method="get" class="style1"> 
    <input type="hidden" name="a" value="txt" />
    <input type="text" name="q" size="55" value="<?php echo ucwords($q .''); ?>" /> 
    <input type="submit" value="Search" /> 
    <input type='hidden' name="num" value="10"></form>
    An encapsulated block-level element is required for the <form> tag. <fieldset>, is the common choice.

    On a side note, you also shouldn't be using the XHTML DOCTYPE (because it's not supported by any version of IE - [unfortunately the world's most popular browser]), and thus the forward slashes (/) should be removed from the declaration.
    For more information, read http://www.webdevout.net/articles/beware-of-xhtml

    HTML Code:
    <form name="_YOUR_FORM_NAME_" action="http://kywordpro.com/redirect.php" method="get" class="style1">
        <fieldset> 
            <input type="hidden" name="a" value="txt">
            <input type="text" name="q" size="55" value="<?php echo ucwords($q .''); ?>"> 
            <input type="submit" value="Search"> 
            <input type='hidden' name="num" value="10">
        </fieldset>
    </form>

Bookmarks

Posting Permissions

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