My question is, how can I not display a form on a page by default?
For example, I have a proxy with options, and the thing is, I do not want to display the options by default, but I want to have a link to the options form. If you don’t get what I mean, here is the page which I’m working on: proxy with options.
Also, here is the code I have on the page currently:
<form action="includes/process.php?action=update" method="post" onsubmit="return updateLocation(this);" class="form">
<input type="text" name="u" id="input" size="40" class="textbox">
<input type="submit" value="Go" class="button"> [<a style="cursor:pointer;" onclick="document.getElementById('options').style.display=(document.getElementById('options').style.display=='none'?'':'none')">options</a>]
<ul id="options">
<?php foreach ($toShow as $option) echo '<li><input type="checkbox" name="'.$option['name'].'" id="'.$option['name'].'"'.$option['checked'].'><label for="'.$option['name'].'" class="tooltip" onmouseover="tooltip(\''.$option['escaped_desc'].'\')" onmouseout="exit();">'.$option['title'].'</label></li>';?>
</ul>
<br style="clear: both;">
</form>
<div class="navigation">
<!--[glype:error]-->
<?php ## Display error messge if applicable
if ( isset($_SESSION['msg']) ) {
echo '<div id="error">',$_SESSION['msg'],'</div>';
unset($_SESSION['msg']);
} ?>
Edit: Also, is there any way I could align the checkboxes with the text?
You could put the form inside a
<div>with the style attributedisplay:nonethen change thatdisplay:blockwhen you need to show the form.Edit: Now that the code has been formatted correctly I can expand on this further. You need to simply have a style on your option ul as display:none. This will mean the options are not visible by default.
If the user made an error AND they had picked an option, I imagine you would want to show the options by default? If so create a variable called $show_options which is false by default but true if any of the options had been picked on submit. Then in your html for the options box use this code:
<ul id="options" style="<?php echo (($show_options)?(''):('display:none')); ?>">