Hi there
I hope this post results in a easy-to-answer one. I’m sure it will.
What I’m busy with at the moment is pretty simple. I’m coding a basic html form with 1 only input text field. Here is the code for the form:
<form action="thanks.php" method="post" name="formulario2">
<input type="text" name="email" id="email" value="" />
<p><input type="button" value="Enviar" onclick="validar(this.checked)"/><input type="reset" name="borrar" value="Borrar"/></p>
</form>
This form is used to add email adresses to a newsletter list which I’ll be handling myself. And It is processed by the following “thanks.php” file:
<?php
$myemail = "myemail@whatever.es";
$myemail. = $email;
$email = $_POST['email'];
$subject = "The sun is shinning";
$headers= 'MIME-Version: 1.0' . "\\r\
";
$headers.= 'Content-type: text/html; charset=utf-8' . "\\r\
";
$headers.= "From: myemail2@whatever.es";
$message = "
Hi there
";
mail($myemail, $subject, $message, $headers);
?>
What I want this php file to do is to send an email (the same email actually) to 2 email recipients. One would be “myemail@whatever.es”. The second one would be whatever email inserted into the html form field with the id=“email”. When running the php file I get this error:
“Parse error: syntax error, unexpected ‘=’ in …/thanks.php on line 5”, being this line 5:
$myemail. = $email;
I thought the problem would be I was calling $email - $myemail. = $email; - before posting it - $email = $_POST[‘email’]; -, so I changed the order… getting the same error. I might be writtng something wrong or missing something, or problably both. Im quite new to PHP I have to admit. Any help on where the problem might be?
Thanks very much in advance.