forms - PHP / Using a class to download a .vcf file -
today need form. save data in vcard, in .vcf format , form in html page , can't submit page. now, if click save button, download in .vcf extension in file there entire html page... need download vcard, , im using class retrived here https://github.com/facine/vcard/blob/master/vcard.class.php. maybe simple_html_dom.php can extract div need... help!
<form method="post" action="#"> <button name="btn_func" class="btn waves-effect waves-light red"> <span class="white-text">salva nella rubrica</i></span> </button> <div id="savecard"> <?php include('simple_html_dom.php'); include('vcard.php'); $card = new vcard(); $card->setnew("first_name", $params['user']->first_name); $card->setnew("last_name", $params['user']->last_name); $card->setnew("birthdate", $params['user']->birthdate); $card->setnew("home_address", $params['user']->address); if(isset($_post['btn_func'])){ $card->download(); } ?> </div></form>
just add header php code.
<form method="post" action="#"> <button name="btn_func" class="btn waves-effect waves-light red"> <span class="white-text">salva nella rubrica</i></span> </button> <div id="savecard"> <?php include('simple_html_dom.php'); include('vcard.php'); $card = new vcard(); $card->setnew("first_name", $params['user']->first_name); $card->setnew("last_name", $params['user']->last_name); $card->setnew("birthdate", $params['user']->birthdate); $card->setnew("home_address", $params['user']->address); if(isset($_post['btn_func'])){ header('content-type: text/x-vcard'); $card->download(); } ?> </div></form> hope helps you..
Comments
Post a Comment