Here is what I mean, Chechu!
Sendmail.php
Best regards,PHP Code:<?php
$defaultVal[0] = "Fill your name here";
$defaultVal[1] = "Fill your name here";
if( $_POST["action"] == "send" )
{
$send = true;
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
// Is name < 0 chars?
if( strlen($name) < 0 )
{
$error[] = "Please fill in your name";
}
// Is email in correct format?
if( !ereg("[[:alnum:]]+@[[:alnum:]]+\.[[:alnum:]]+", $email ) )
{
$error[] = "Please insert correct email";
}
// Is message < 5 chars?
if( strlen($message) < 5 )
{
$error[] = "Please fill in your name";
}
// Number of errors!
$num_of_error = count($error);
// Is there any errors? No, good send it!
if( $num_of_error == 0 )
{
include("messenger.lib");
$messenger = new messenger();
// Set this to your own name and email-address ...
$messenger->setFrom("info@cecicasariego.com", "Admin");
$messenger->setBCC("jurgen.schepers@euphonynet.be", "Jurgen");
$messenger->setBCC("info@cecicasariego.com", "Admin");
// Set priority: 1 = High, 3 = Normal, 5 = Low
$messenger->setPrio(1);
// Set the subject ...
$messenger->setSubject("Je bericht aan hetbestevoordeel.be");
// The user information
$messenger->setUserInfo( array(
"NAME" => $name,
"MESSAGE" => $message,
"DATE" => date("M d, Y H:i.s", time())
) );
// To who is it?
$messenger->setTo($email, $name);
// Find the template you will use and send away ...
$messenger->prepare_file( "message", true);
if( $messenger->execute("email") )
{
$info = '<p align="center"><font color="#003366">Je bericht is goed verzonden<br>en je zult een bevestiging ontvangen.<br>We beantwoorden je zo snel mogelijk.</font></p>';
}
else
{
$info = '<p align="center"><font color="#FF0000">Gelieve alle gegevens in te vullen!</font></p><p><a href="contact.html">[terug]</a>';
}
}
// :( There was errors, put information about the errors again.
else
{
$info = "All data must be filled correctly before you send it!";
$defaultVal[0] = $name;
$defaultVal[1] = $email;
$defaultVal[2] = $message;
}
}
?>
<script language="JavaScript" type="text/JavaScript">
function clearDefault(el) {
if (el.defaultValue==el.value) el.value = ""
}
</script>
<table border="1" cellpadding="0" cellspacing="0">
<form action="sendmail.php" method="POST">
<input type="hidden" name="action" value="send">
<tr><td colspan="2"><?php echo $info; ?></td></tr>
<tr><td>Name:</td><td><input type="text" name="name" value="<?php echo $defaultVal[0] ?>" OnFocus="javascript:clearDefault(this);"></td></tr>
<tr><td>Email:</td><td><input type="text" name="email" value="<?php echo $defaultVal[1] ?>" OnFocus="javascript:clearDefault(this);"></td></tr>
<tr><td>Message:</td><td><textarea cols="15" rows="4" name="message"><?php echo $defaultVal[2] ?></textarea></td></tr>
<tr><td colspan="2"><input type="submit" value="Send"></td></tr>
</table>
mbrodin

