0
votes

I'm trying to create a simple inline form that displays an entry field followed by a submit button - how can I alter this existing code so that these elements display horizontally in one row? ...I've tried altering the form class but no success. Thank you in advance.

PHP

<div class="d3-mailchimp" data-block-id="<?php echo $bID; ?>">
<?php 
if (isset($errors)) {
    $errors->output();
}

if (isset($message)) {
    echo '<p class="message">'.$message.'</p>';
} else {
    ?>
    <form method="post" action="<?php echo $this->action('submit') ?>" onsubmit="d3_mailchimp_submit(this); return false;">
        <?php $token->output('d3_mailchimp.subscribe'); ?>

        <div class="form-group field">
            <?php    
            echo $form->email('email_address', '', [
                'required' => 'required',
                'placeholder' => t(''),
            ]);
            ?>
        </div>

        <?php
        if ($showTermsCheckbox) {
            ?>
            <div class="accept-terms">
                <label for="accept_terms">
                    <?php
                    echo $form->checkbox('accept_terms', 1, 0, [
                        'required' => 'required',
                    ]);
                    ?>
                    <?php echo $acceptTermsText; ?>
                </label>
            </div>
            <?php
        }
        ?>

        <div class="submit-button">
            <?php 
            echo $form->submit('submit', t('Subscribe'), [
                'class' => 'button',
            ]);
            ?>
        </div>
    </form>
    <?php    
}
?>

You have two fields - "email" and "accept terms", and then a button. You want all of those laid out horizontally in one row, is that right? Also, you'll need to show us the relevant CSS classes so we know how they affect your divs. - ADyson
P.S. what does this have to do with mailchimp? This seems primarily a HTML and CSS question - I suggest you add those tags, and remove any which aren't actually directly relevant to the question. Then your question is more likely to be seen by people with relevant expertise to help with your layout issue. - ADyson
@ADyson thank you - yes I want to display elements horizontally in one row. - amara
ok so please provide the CSS information I requested. CSS plays an important role in determining the final layout, as well as the HTML. - ADyson
Thank you @ADyson - Unfortunately, I'm not sure how to provide the exact CSS information that you would require. Are you able to quickly inspect it on my site? I've placed a copy of the form just before the page footer at: collierhomes.com.au/typography - amara