hi all
well I have managed to create my contact page form which works better than I expected
here is a sample of the code.
<?php
$content = 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Mauris vel magna. Mauris risus nunc, tristique varius, gravida in, lacinia vel, elit. Nam ornare, felis non faucibus molestie, nulla augue adipiscing mauris, a nonummy diam ligula ut risus. Praesent varius. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.';
?>
<p><?=$content;?></p>
<?php
$errmsg = ''; // error message
$errmsg2 = '';// error heading
$name = ''; // sender's name
$company = ''; // sender's company name
$telephone = ''; // senders telephone number
$email = ''; // sender's email address
$message = ''; // the message itself
$browser = $HTTP_USER_AGENT;
$ip = $REMOTE_ADDR;
if(isset($_POST['send']))
{
$name = $_REQUEST['name'] ;
$company = $_REQUEST['company'] ;
$telephone = $_REQUEST['telephone'] ;
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
if(trim($name) == '')
{
$errmsg2 = 'ERROR';
$errmsg = 'Please enter your name';
}
else if(trim($company) == '')
{
$errmsg2 = 'ERROR';
$errmsg = 'Please enter the name of your company';
}
else if(trim($telephone) == '')
{
$errmsg2 = 'ERROR';
$errmsg = 'Please enter a contact number';
}
else if(trim($email) == '')
{
$errmsg2 = 'ERROR';
$errmsg = 'Please enter your email address';
}
else if(!isEmail($email))
{
$errmsg2 = 'ERROR';
$errmsg = 'Your email address is not valid';
}
else if(trim($message) == '')
{
$errmsg2 = 'ERROR';
$errmsg = 'Please enter your message';
}
else if($errmsg == '')
{
$content = 'cool';
}
if($errmsg == '')
{
if(get_magic_quotes_gpc())
{
$company = stripslashes($company);
$telephone = stripslashes($telephone);
$subject = stripslashes($subject);
$message = stripslashes($message);
}
well this is what I have so far. the validation works has expected but I want to do one more thing if possible I want the $content value to change to the word cool after the from is processed or if the value of $errmsg = ‘’;
being playing with it for a while and still no joy. Can it be done.
all help is welcome
regards
w9914420