lundi 4 décembre 2017

Printing Separate Multiple Pages Simultaneously with Checkbox Form

I have created a checkbox form which passes id values to a controller. It will then be processed to open up links based on the ids passed.

Example:

www.sample.com/001

www.sample.com/002

www.sample.com/003

The results are executed from a loop and if there are 3 checkboxes checked, it will open up 3 separate tabs. The webpages are labels I created to print.

Checkbox form:

<div class="col">
    <fieldset>
        <form action="link..." method="post"> 
            <p>
                {foreach from=$await item=row}
                <input type="checkbox" name="await[]" maxlength="50" value={$row.id_order}>
                <label> ID: <b>{$row.id_order}</b></label><br/>
                {/foreach}
                <br/>
                <input id="submit" name="submitgeneratelabels" type="submit" value="GENERATE LABELS" class="button" />
            </p>
        </form>
    </fieldset>
</div>

PHP controller codes:

//Generate Labels
if (Tools::isSubmit('submitgeneratelabels')) {
    $ids= Tools::getValue('labels');
    echo "<script>";

    foreach ($ids as $updateids) {
        $url='link...' //based on ids
        echo "window.open('$url');";
    }
    echo "</script>";
}

Currently, the pages are rendering fine. I would like to print these webpages separately at a go. (I do not need to specifically open the webpages if I am able to print). Is this possible?

Example: User will choose the checkboxes option needed and click on button. The webpages will be printed simultaneously.

Appreciate any guidance to assist on the above. Thank you.




Aucun commentaire:

Enregistrer un commentaire