Log in

View Full Version : PHP Hidden value



tgallagher26
05-04-2009, 06:34 PM
Ok so I want to take this 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?

Nile
05-04-2009, 06:40 PM
This should do it:


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

boogyman
05-05-2009, 01:34 AM
This should do it:


<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



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