Simple submit name/email script

MyOwnDemon

Face Rocker
Jan 28, 2007
3,529
27
48
Iowa
www.sitestomp.com
Hey guys, looking for something simple.

Just need some code to allow someone to submit a name/email address and have it email it to my client. Anyone have any resources or links on how to do this? Doesn't have to be complex or fancy. Thanks!
 


tumblr_lk3sb8dYHP1qbvihuo1_500.gif
 
Code:
<?php
if(!$_GET['submit']) {
	//show form
	echo '
	<form action="'.$_SERVER['PHP_SELF'].'" method="GET">
	Name: <input type="text" name="inName" /><br />
	Email: <input type="text" name="inMail" /><br />
	<input type="submit" name="submit" value="Submit" />
	</form>
	';
}
else
{
	if($_GET['inName'] !== '' && $_GET['inMail'] !== '') {
		//mail
		$name = $_GET['inName'];
		$mail = $_GET['inMail'];
		
		$to = 'email@domain.tld';
		$subject = 'subject';
		$message = "Name: $name\nEmail: $mail";
		
		mail($to, $subject, $message);
	}
}
?>

Tis basically how you'd go about it, if you're interested in actually learning.