Parse error: syntax error, unexpected T_STRING
este es el codigo de mi form
Código HTML:
<form method="POST" action="enviar.php" enctype="multipart/form-data"> <div class="row 50%"> <div class="6u 12u(mobilep)"> <div align="left"> <input type="text" name="name" id="name" placeholder="Nombre" /> </div> </div> <div class="6u 12u(mobilep)"> <div align="left"> <input type="email" name="email" id="email" placeholder="Email" /> </div> </div> </div> <div class="row 50%"> <div class="12u"> <div align="left"> <textarea name="message" id="message" placeholder="Mensaje" rows="5"></textarea> </div> </div> </div> <div class="row 50%"> <div class="12u"> <ul class="actions"> <div align="left"> <li><input type="file" name="foto" /></li> <div align="left"> <br><ul class="actions"> <li><input type="submit" class="button alt" value="Enviar" /> </li> </ul> </div> </div> </form
Código PHP:
<?php
if ($_POST){
$num = md5(time());
//MAIL BODY
$body = "
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=gb18030">
<title>Formulario Contactenos</title>
</head>
<body style='background:#EEE; padding:30px;'>
$body .= "
<strong style='color:#0090C6;'>Nombre: </strong>
<span style='color:#767676;'>" . $_POST["name"] . "</span><br/>";
$body .= "
<strong style='color:#0090C6;'>Email: </strong>
<span style='color:#767676;'>" . $_POST["email"] . "</span><br/>";
$body .= "
<strong style='color:#0090C6;'>Mensaje: </strong>
<span style='color:#767676;'>" . $_POST["message"] . "</span><br/>";
$body .= "</body></html>";
$_name=$_FILES["archivo1"]["name"];
$_type=$_FILES["archivo1"]["type"];
$_size=$_FILES["archivo1"]["size"];
$_temp=$_FILES["archivo1"]["tmp_name"];
if( strcmp($_name, "") ) //FILES EXISTS
{
$fp = fopen($_temp, "rb");
$file = fread($fp, $_size);
$file = chunk_split(base64_encode($file));
// MULTI-HEADERS Content-Type: multipart/mixed and Boundary is mandatory.
$headers = $headers = "From: Anfach Valpo<contacto@anfachvalpo.cl>rn";
$headers .= "MIME-Version: 1.0rn";
$headers .= "Content-Type: multipart/mixed; ";
$headers .= "boundary=".$num."rn";
$headers .= "--".$num."n";
// HTML HEADERS
$headers .= "Content-Type: text/html; charset=UTF-8rn";
$headers .= "Content-Transfer-Encoding: 8bitrn";
$headers .= "".$body."n";
$headers .= "--".$num."n";
// FILES HEADERS
$headers .= "Content-Type:application/octet-stream ";
$headers .= "name="".$_name."\"r\n";
$headers .= "Content-Transfer-Encoding: base64\r\n";
$headers .= "Content-Disposition: attachment; ";
$headers .= "filename=\"".$_name."\"\r\n\n";
$headers .= "".$file."\r\n";
$headers .= "--".$num."--";
}else { //FILES NO EXISTS
// HTML HEADERS
$headers = "From: Anfach Valpo\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
$headers .= "Content-Transfer-Encoding: 8bit\r\n";
}
// SEND MAIL
mail("[email protected]", "Informacion del Socio" , $body, $headers);
header("location: contacto_1.html");
}
?>