I have a form which get 2 fields: name and mail.
I want the submit button to send a mail to the email message with the name the user write to the mail that the user write. Here is my code:
PHP:
<html>
<body>
<?php
if(isset($_POST['submit'])){
echo "in mail." . PHP_EOL;
$username= $_POST['txtUsername'];
echo $username. PHP_EOL;
$email= $_POST['txtEmail']
echo $email. PHP_EOL;
$message = wordwrap($username, 70, "\r\n");
echo $message . PHP_EOL;
mail($email, 'lead', $message);
}
?>
</body>
</html>
HTMl:
<!DOCTYPE html>
<html lang="he">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta charset="utf-8" />
<title>site</title>
</head>
<body di
r="rtl">
<form method="post" action="sendMail.php">
<input type="text" name="txtUsername" placeholder="a" />
<input type="text" name="txtEmail" placeholder="b" />
<input type="submit" value="submit" name="submit">
</form>
but I got Parse error: syntax error, unexpected T_ECHO in /home/a9816954/public_html/sendMail.php on line 10
What should be the problem? Is there a way to send the mail and stay in the corrent page using only php and html?
Thank you.