简体   繁体   中英

Select list and submit button on same line with CakePHP

I'm using a select list and submit button with CakePHP but I'm trying to get it on the same line and I can't figure it out. I've tried putting them in a table as well but that didn't work either.

Here is the form

<div class="visits options">
    <?php
       echo $this->Form->create('Sort_Visits');
       echo $this->Form->input('Sort', array('options' => $options));
       echo $this->Form->end(__('Submit')); 
    ?>
</div>

Here's the CSS

div.options {
    float: left;
    width:50%;
    vertical-align: top;
}

Here's the output

<div class="visits options">
<form action="/visits/index" id="Sort_VisitsIndexForm" method="post" accept-charset="utf-8"><div style="display:none;"><input type="hidden" name="_method" value="POST"/><input type="hidden" name="data[_Token][key]" value="233e6286a426dc782186142dde352208eddc8349" id="Token1459082309"/></div><div class="input select"><label for="Sort_VisitsSort">Sort</label><select name="data[Sort_Visits][Sort]" id="Sort_VisitsSort">
<option value="today">Today</option>
<option value="this_week">This Week</option>
<option value="filled">This Month</option>
<option value="not_filled">Previous Visits</option>
</select></div><div class="submit"><input  type="submit" value="Submit"/></div><div style="display:none;"><input type="hidden" name="data[_Token][fields]" value="a17c91b362e9e635b23dfd139c314f081f977590%3A" id="TokenFields1535487420"/><input type="hidden" name="data[_Token][unlocked]" value="" id="TokenUnlocked1391584397"/></div></form>      
</div>

This ended up working for me in my browser using float.

.input {
    float:left;
}

.submit {
    float:left;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM