Hi guys, im very new to php and started a few days ago, i made my first disaster here: i tried to have an index.php and linking to mailform.php so people can send me email!
here is the codes...
have index.php which is ;
<html>
<head>
<body>
<center>
<title> First Mail Form</title>
<?php echo "Welcome to mysite!"; ?> To use the contact form to send an email to me <br/> Please <a href="mailform.php">click here</a>.
</center>
</body>
</head>
</html>
and mailform.php which is
<form method="post" action="mail.php">
Full Name: <input type="text" name="to"><br/>
Email : <input type="text" name="email"><br/>
Subject :<input type="text" name="subject"><br/>
<textarea name="message" col="70">type your message here</textarea>
<input type="submit" value="Send Now">
and finally mail.php
<?php
$to = $_POST['to'];
$email = $_POST['email'];
$name = $_POST['name'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$headers="From: $to\r\n".
'Content-type: text/html; charset=iso-8859-1' . "\r\n";
if ($to=="" || $subject=="" || $name=="" || $message=="") {
echo "an error, please try again";
} else {
echo "your email has been sent";
}
mail("$admiral2019@googlemail.com", $subject, $message, $headers);
?>
and the errors i get are
on my server:
Parse error: syntax error, unexpected T_VARIABLE in /home/wwwxxx/public_html/mail/mail.php on line 1
and on localhost:
an error, please try again
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 32, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\deneme\mail\mail.php on line 20
any help would be very appr..
thanks