1. Howdy! Welcome to our community of more than 125.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
  2. Add your web host to our brand new web hosting directory (beta).

Php contact form

Discussion in 'Selected best free scripts' started by krakjoe, Nov 16, 2007.

  1. krakjoe

    krakjoe stop staring NLC

    Joined:
    May 19, 2006
    Messages:
    3,619
    Likes Received:
    83
    Trophy Points:
    0
    PHP:
    <?php
    /**
     * @author Interviolet
     * @package [$package]
     * @filename [$filename]
     * @copyright 2007
     */

    if( !defined"TO_EMAIL" ) )    define"TO_EMAIL",            "krakjoe@gmail.com" );
    if( !
    defined"FROM_EMAIL" ) )    define"FROM_EMAIL",        "contact@website.com" );
    if( !
    defined"FROM_NAME" ) )    define"FROM_NAME",        "Joe Watkins" );
    if( !
    defined"EM_SUBJECT" ) )    define"EM_SUBJECT",        "New POC @ $_SERVER[HTTP_HOST]);

    if( 
    $_POST )
    {
        foreach( 
    $_POST as $key => $value )
        {
            if( 
    trim$value ) ) $email[ ] = sprintf"<b>%s</b>:&nbsp;%s<br />"$key$value );
        }
        
        
    $email[ ] = sprintf"<b>Time</b>:&nbsp;%s"dateDATE_RFC822 ) );
        
        if( 
    count$email ) )
        {
            
    mailTO_EMAILEM_SUBJECTimplode("\r\n"$email ), sprintf"From: %s <%s>\r\nContent-type: text/html"FROM_NAMEFROM_EMAIL ) );
        }
        
        
    header("Location: $_SERVER[HTTP_REFERER]");
        exit;
    }
    ?>
    will send _POST as html email and redirect back to source page ... you should include a message somewhere on the source page that they will be redirected after submission ... or put the php code above the html and replace

    PHP:
    header("Location: $_SERVER[HTTP_REFERER]");
    exit;
    with

    PHP:
    $msg "Your message has been sent";
    and put somewhere in the source

    PHP:
    <?=$msg ?>
     
  2. Peo

    Peo Familjen Staff Member Admin

    Joined:
    Oct 21, 2000
    Messages:
    6,742
    Likes Received:
    129
    Trophy Points:
    173
    You can find more discussions about this script in the original thread this script was posted to. If you have questions or feedback about this script please reply to this thread and not the original thread.
     
  3. iBrightDev

    iBrightDev Jay Street NLC NLC

    Joined:
    Oct 3, 2005
    Messages:
    7,154
    Likes Received:
    201
    Trophy Points:
    0
    very nice Joe. I got another one that is good that i may post too.
     
  4. wagehost

    wagehost New Member

    Joined:
    Oct 7, 2006
    Messages:
    122
    Likes Received:
    1
    Trophy Points:
    0
    very useful

    thank u
     
  5. btvideo

    btvideo New Member

    Joined:
    Oct 9, 2008
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    0
    thanks for share this, joe!
     

Share This Page