简体   繁体   中英

Wrap Table and sent e-mail with a Button

Is possible with one JavaScript function and a button send email an already printed html table ?

<table id="mytable">
</table>

I did a PHP function and i call everyware i need to send my results.

The call

<?php SendEmailForm("MyIdElementToSend"); ?>

and the function

function SendEmailForm ($MyIdElementToSend){
?>
<form id="EMailForm" action="SendMail.php?SendMail=true" method="post">
    <div class="form-group">
        <div class="row">
            <div class="hide">
                <input id="msg" type="text" class="form-control" name="msg" value="" />
            </div>
            <div>
                <button id="sub" type="submit" class="btn btn-primary"><i class="fa fa-envelope" aria-hidden="true"></i> Send</button>
            </div>
        </div>
    </div>
</form>
<script>
    document.getElementById("msg").value = document.getElementById("<?php echo $MyIdElementToSend ?>").outerHTML;
</script>

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