Como le hago para que un botón ejecute una función de php cuando le hago clip?
Estoy intentando hacer que envíe un correo, pero cuando cargo la pagina envía un correo en blanco, después si le doy en el botón me envía el correo con el mensaje, y si recargo la pagina vuelve a mandar el correo, yo quiero que lo mande solo cuando hacen clip en el botón, el código que tengo es este:
Código:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Correo</title>
</head>
<body>
<script>
function correo (){
<?php
mail("[email protected]","asunto",$_POST['Text1']) ;
?>
}
</script>
<form method="post">
<input type="text" name="Text1"/>
<input type="submit" value="Enviar" onclick="correo()" name="miBoton"/>
</body>
</html>