Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more  

Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Web Programming > Databases - MySQL, SQL, Oracle, Access and others
User Name
Password

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 10-31-2006, 04:35 PM   #1 (permalink)
thefresh
Junior Member
 
Join Date: Oct 2006
Posts: 2
Default web contact form into vcf file format?

Is it possible that the data submited on my website from a contact form could be sent to my inbox as a vcf format so that I could add it directly to my contacts in outlook? or is there a way in which the contct information sent to me from my webform could be directly put into my contacts in outlook using an automated method?

I am new to this and know a little html and css so any help would be appreciated
thefresh is offline   Reply With Quote
Sponsored Links
Old 11-13-2006, 11:40 AM   #2 (permalink)
karlkatzke
Junior Member
 
Join Date: Nov 2006
Location: College Station, TX
Posts: 6
Default Re: web contact form into vcf file format?

You'd want to do this with a little bit of PHP, or another scripting language of your choice. Here's a quick example PHP script that can do it if you set up the right variables and then call it; this one will display the vcard to screen though. You could easily remove the header calls and then use PHP's mail function to output $vard as an email attachment.

PHP Code:
<?php
        
# To access the functions in this document you should include this document in you PHP application with the #
    # string include("/path/vcard.inc"); or some similar funtions. All variables that is used in this document  #
    # have a prefix that starts with $vcard_ - so you should really not use them in your own application        #
    # besides those variables that are listed below (you dont have to include those values that you dont have   #
    # use for) wich is used as data feed to this document.                                                      #
    # This file will return an vCard Version 3.0 Compliant file to the user. Observe that you should set up     #
    # your web-server with the correct MIME-type. The reason to use the \r\n as breakes is because it should be #
    # more compatible with MS Outlook. All other, better coded, clients sholdnt have any problems with this.    #
    # Version 1.0 (2003-08-29)                                                                                  #
    # Author: Alf Lovbo <affe@stab.nu>                                                                          #
    # This document is released under the GNU General Public License.                                           #
    # USAGE                                                                                                     #
    # -----                                                                                                     #
    # The following variables can be used togheter with this document for accessing the functions supplied. All #
    # of the functions listed below takes an value described by the comment after the |-symbol.                 #
    #                                                                                                           #
    # $vcard_birtda | Birthday YYYY-MM-DD                $vcard_f_name | Family name                            #
    # $vcard_cellul | Cellular Phone Number              $vcard_compan | Company Name                           #
    # $vcard_h_addr | Street Address (home)              $vcard_h_city | City (home)                            #
    # $vcard_h_coun | Country (home)                     $vcard_h_fax  | Fax (home)                             #
    # $vcard_h_mail | E-mail (home)                      $vcard_h_phon | Phone (home)                           #
    # $vcard_h_zip  | Zip-code (home)                    $vcard_nickna | Nickname                               #
    # $vcard_note   | Note                               $vcard_s_name | Given name                             #
    # $vcard_uri    | Homepage, URL                      $vcard_w_addr | Street Address (work)                  #
    # $vcard_w_city | City (work)                        $vcard_w_coun | Country (work)                         #
    # $vcard_w_fax  | Fax (work)                         $vcard_w_mail | E-mail (work)                          #
    # $vcard_w_phon | Phone (work)                       $vcard_w_role | Function (work)                        #
    # $vcard_w_titl | Title (work)                       $vcard_w_zip  | Zip-code (work)                        #
        #                                                                                                           #
        
$vcard_sortst $vcard_f_name;

        
$vcard_tz date("O");
        
$vcard_rev date("Y-m-d");

    
$vcard "BEGIN:VCARD\r\n";
    
$vcard .= "VERSION:3.0\r\n";
#    $vcard .= "CLASS:PUBLIC\r\n";
    
$vcard .= "PRODID:-//PHP vCard Class//NONSGML Version 1//SE\r\n";
    
$vcard .= "REV:" $vcard_rev "\r\n";
    
$vcard .= "TZ:" $vcard_tz "\r\n";
    if (
$vcard_f_name != ""){
        if (
$vcard_s_name != ""){
            
$vcard .= "FN:" $vcard_s_name " " $vcard_f_name "\r\n";
            
$vcard .= "N:" $vcard_f_name "," $vcard_s_name "\r\n";
        }
        else {
            
$vcard .= "FN:" $vcard_f_name "\r\n";
            
$vcard .= "N:" $vcard_f_name "\r\n";
        }
    }
    elseif (
$vcard_s_name != ""){
        
$vcard .= "FN:" $vcard_s_name "\r\n";
        
$vcard .= "N:" $vcard_s_name "\r\n";
    }
    if (
$vcard_nickna != ""){
        
$vcard .= "NICKNAME:" $vcard_nickna "\r\n";
    }
    if (
$vcard_compan != ""){
        
$vcard .= "ORG:" $vcard_compan "\r\n";
#        $vcard .= "SORTSTRING:" . $vcard_compan . "\r\n";
    
}
    elseif (
$vcard_f_name != ""){
#        $vcard .= "SORTSTRING:" . $vcard_f_name . "\r\n";
    
}
    if (
$vcard_birtda != ""){
        
$vcard .= "BDAY:" $vcard_birtda "\r\n";
    }
    if (
$vcard_w_role != ""){
        
$vcard .= "ROLE:" $vcard_w_role "\r\n";
    }
    if (
$vcard_w_titl != ""){
        
$vcard .= "TITLE:" $vcard_w_titl "\r\n";
    }
    if (
$vcard_note != ""){
        
$vcard .= "NOTE:" $vcard_note "\r\n";
    }
    if (
$vcard_w_mail != ""){
        
$vcard .= "EMAIL;TYPE=INTERNET,PREF:" $vcard_w_mail "\r\n";
        if (
$vcard_h_mail != ""){
            
$vcard .= "EMAIL;TYPE=INTERNET:" $vcard_h_mail "\r\n";
        }
    }
    elseif (
$vcard_h_mail != ""){
        
$vcard .= "EMAIL;TYPE=INTERNET,PREF:" $vcard_h_mail "\r\n";
    }
    if (
$vcard_cellul != ""){
        
$vcard .= "TEL;TYPE=VOICE,CELL:" $vcard_cellul "\r\n";
    }
    if (
$vcard_h_fax != ""){
        
$vcard .= "TEL;TYPE=FAX,HOME:" $vcard_h_fax "\r\n";
    }
    if (
$vcard_w_fax != ""){
        
$vcard .= "TEL;TYPE=FAX,WORK:" $vcard_w_fax "\r\n";
    }
    if (
$vcard_h_phon != ""){
        
$vcard .= "TEL;TYPE=VOICE,HOME:" $vcard_h_phon "\r\n";
    }
    if (
$vcard_w_phon != ""){          
                
$vcard .= "TEL;TYPE=VOICE,WORK:" $vcard_w_phon "\r\n";         
        }
    if (
$vcard_uri != ""){
        
$vcard .= "URL:" $vcard_uri "\r\n";
    }
    if (
$vcard_h_addr != ""){
        
$vcard_addr ";;" $vcard_h_addr;
        
$vcard_labl $vcard_h_addr;
    }
    if (
$vcard_h_city != ""){
        if (
$vcard_addr != ""){
            
$vcard_addr .= ";" $vcard_h_city;
        }
        else{
            
$vcard_addr .= ";;;" $vcard_h_city;
        }
        if (
$vcard_labl != ""){
            
$vcard_labl .= "\\r\\n" $vcard_h_city;
        }
        else {
            
$vcard_labl $vcard_h_city;
        }
    }
    if (
$vcard_h_zip != ""){
        if (
$vcard_addr != ""){
                        
$vcard_addr .= ";" $vcard_h_zip;
                }
                else{
                        
$vcard_addr .= ";;;;" $vcard_h_zip;
                }
                if (
$vcard_labl != ""){
                        
$vcard_labl .= "\\r\\n" $vcard_h_zip;
                }
                else {
                        
$vcard_labl $vcard_h_zip;
                }
    }
    if (
$vcard_h_coun != ""){
                if (
$vcard_addr != ""){
                        
$vcard_addr .= ";" $vcard_h_coun
                }
                else{
                        
$vcard_addr .= ";;;;;" $vcard_h_coun
                }
                if (
$vcard_labl != ""){
                        
$vcard_labl .= "\\r\\n" $vcard_h_coun
                }
                else {
                        
$vcard_labl $vcard_h_coun;
                }
        }
    if (
$vcard_addr != ""){
        
$vcard .= "ADR;TYPE=HOME,POSTAL,PARCEL:" $vcard_addr "\r\n";
    }
    if (
$vcard_labl != ""){
        
$vcard .= "LABEL;TYPE=DOM,HOME,POSTAL,PARCEL:" $vcard_labl "\r\n";
    }
    
$vcard_addr "";
    
$vcard_labl "";
    if (
$vcard_w_addr != ""){
                
$vcard_addr ";;" $vcard_w_addr;
                
$vcard_labl $vcard_w_addr;
        }
    if (
$vcard_w_city != ""){
                if (
$vcard_addr != ""){
                        
$vcard_addr .= ";" $vcard_w_city;  
                }
                else{ 
                        
$vcard_addr .= ";;;" $vcard_w_city;
                }
                if (
$vcard_labl != ""){
                        
$vcard_labl .= "\\r\\n" $vcard_w_city;
                }
                else {
                        
$vcard_labl $vcard_w_city;
                }
        }
    if (
$vcard_w_zip != ""){
                if (
$vcard_addr != ""){
                        
$vcard_addr .= ";" $vcard_w_zip;
                }
                else{
                        
$vcard_addr .= ";;;;" $vcard_w_zip;
                }
                if (
$vcard_labl != ""){
                        
$vcard_labl .= "\\r\\n" $vcard_w_zip;
                }
                else {  
                        
$vcard_labl $vcard_w_zip;
                }
        }
    if (
$vcard_w_coun != ""){
                if (
$vcard_addr != ""){
                        
$vcard_addr .= ";" $vcard_w_coun;
                }
                else{
                        
$vcard_addr .= ";;;;;" $vcard_w_coun;
                }
                if (
$vcard_labl != ""){
                        
$vcard_labl .= "\\r\\n" $vcard_w_coun;
                }
                else {
                        
$vcard_labl $vcard_w_coun;
                }
        }
    if (
$vcard_addr != ""){
                
$vcard .= "ADR;TYPE=WORK,POSTAL,PARCEL:" $vcard_addr "\r\n";
        }
        if (
$vcard_labl != ""){
                
$vcard .= "LABEL;TYPE=DOM,WORK,POSTAL,PARCEL:" $vcard_labl "\r\n";
        }
    
$vcard .= "END:VCARD\n";
    
header("Content-type: text/x-vCard");
    
header("Content-Disposition: attachment; filename=vcard.vcf");
    
header("Pragma: public");
    echo 
$vcard;
?>
__________________
Karl Katzke - Available for RHEL/CentOS admin, and small PHP/HTML/XHTML jobs.

Last edited by karlkatzke : 11-13-2006 at 11:43 AM.
karlkatzke is offline   Reply With Quote
Old 03-04-2008, 10:29 AM   #3 (permalink)
Allensmith
Junior Member
 
Join Date: Mar 2008
Posts: 1
Default Re: web contact form into vcf file format?

I am using this code it's very help for me but i am facing one problem when mail is sent to user it's giving the attachment with "noname" with no extension i am using this code with PHP

Please help me out it's very urgent


thanks in advance,
Allensmith is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Points Per Thread View: 1.00
Points Per Thread: 11.00
Points Per Reply: 5.00



» Sponsors

» Links

» Affiliates
Web Hosting
Marketing Find
Merchant Select
SiteMap Builder
Host Compare
Dedicated Servers

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 06:31 PM.



LinkBacks Enabled by vBSEO 3.0.0 RC8
Webmaster Forums