I have this code and it outputs buttons that goes down. I want them to go horizontally. please help. T_T

<?php

    $var=1;
    while($row=mysql_fetch_array($che… {
    ?>

    < action='' method='post'>
    <input type='submit' name='view' value="<?php echo @$var ?>"/>
    <input name="workId" type="hidden" value="<?php echo $row['workId']; ?>" />
    </form>  

<?php $var++; } ?>

I don't want to put it inside table and loop it as a <td>
i just want it to loop and follow the size of the container. :(
if i put the <form></form> outside the loop, only the last value would be stored on the values of the buttons :(

call me a noob or whatever. all I want is to learn. T_T

Recommended Answers

All 3 Replies

Make your input's float left with CSS and they will automatically fill your container horizontally (if that's what you mean).

Try this out for your buttons

.button-box {
    float:left;
    margin-right:20px;
    margin-bottom:10px;
}



<div class="button-box">
<input type="submit" name="" value="" />
<input type="hidden" name="" value="" />
</div>

thank you!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.