• Howdy! Welcome to our community of more than 130.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

help ~ php contact form

krakjoe

stop staring
NLC
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", date( DATE_RFC822 ) );
	
	if( count( $email ) )
	{
		mail( TO_EMAIL, EM_SUBJECT, implode("\r\n", $email ), sprintf( "From: %s <%s>\r\nContent-type: text/html", FROM_NAME, FROM_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 ?>
 
Last edited:

krakjoe

stop staring
NLC
I gave up the weed ... being natrually tired is the strangest feeling in the world ... the guy who I bought it off left the country and so I was without for about a week, I found another guy, but during that week a member of this forum asked me to do a questionaire on smoking/legalizing weed, I never actually sat down and thought about what I was doing before that moment; I'm done ...
 

Peo

Administrator
Staff member
Admin
The krakjoe script above is what warrants this thread to be in this section.
 

Jan

Forum Cleaner
NLC
Maybe the script itself should be copied over? It is a help topic after all.
 
Top