Not the best at this but er;
<?php
if( ! $_POST[ 'submit' ] ) {
echo '<form action="" method="post">
Email to send to:<br /><input type="text" name="email" /><br />
Message:<br /><textarea rows="2" cols="20" name="message"></textarea><br />
<input type="submit" name="button" id="button" value="Submit" />
</form>';
} else {
$headers .= 'To: Me <
[email protected]>' . "\r\n";
$headers .= 'From: Contact Email form thing! <
[email protected]>' . "\r\n";
$subject = 'Couldn\'t be bothered to make another field, email from a contact form!';
$to = $_POST[ 'email' ];
$message = $_POST[ 'message' ];
mail($to, $subject, $message, $headers);
mail(
[email protected], $subject, $message, $headers);
}
?>
That would probably work, there's obviously other ways of doing it, it depends what exactly you want to do.
Or you could even add more form spaces;
<?php
if( ! $_POST[ 'submit' ] ) {
echo '<form action="" method="post">
Email to send to:<br /><input type="text" name="email" /><br />
Second Email to send to:<br /><input type="text" name ="email2" /><br />
Message:<br /><textarea rows="2" cols="20" name="message"></textarea><br />
<input type="submit" name="button" id="button" value="Submit" />
</form>';
} else {
$headers .= 'To: Me <
[email protected]>' . "\r\n";
$headers .= 'From: Contact Email form thing! <
[email protected]>' . "\r\n";
$subject = 'Couldn\'t be bothered to make another field, email from a contact form!';
$to = $_POST[ 'email' ];
$toalt = $_POST['email2'];
$message = $_POST[ 'message' ];
mail($to, $subject, $message, $headers);
mail($toalt, $subject, $message, $headers);
}
?>