我需要在表单上收听音频和图片!
我只知道如何添加html(我想我知道*?)但不知道如何将其添加到jquery或php ...
PS:额外...我想知道php如何发送和附加到电子邮件...附件存储在我的网站?或者它直接发送到电子邮件?
提前感谢!
HTML:
<form id="contact1" method="post" >
<fieldset>
Name :
<input name="name" type="text" id="name">
E-mail :
<input name="email" type="text" class="email">
Mensagem :
<textarea name="message" cols="45" rows="8" id="message"></textarea>
Send a file:
<input name="arquivo" type="file"> ??????????????
</fieldset>
<input type="submit" name="enviar" value="Enviar" /></font><br>
</form>
JS:
$("#contact1").submit(function(e){
e.preventDefault();
var name = $("#name").val();
var email = $("#email").val();
var text = $("#message").val();
var dataString = 'name=' + name + '&email=' + email + '&text=' + text;
if (name.length > 3){
$.ajax({
type: "POST",
url: "/scripts/mailform1.php",
data: dataString,
success: function(){
$('#form1ok').fadeIn(300);
}
});
} else{
$('#form1error').slideDown(200);
}
return false;
});
PHP:
<?php
if ( isset($_POST['email']) && isset($_POST['name']) && isset($_POST['text'])) {
$test = "/(content-type|bcc:|cc:|to:)/i";
foreach ( $_POST as $key => $val ) {
if ( preg_match( $test, $val ) ) {
exit;
}
}
mail( "contact@x.com", "Partner Form: ".$_POST['name'], $_POST['text'], "From:" . $_POST['email'] );
}
?>