我很新的編碼,我試圖建立使用代碼從這裏聯繫表格:http://codepen.io/rexkirby/pen/FdnlzPHP的幫助HTML/CSS的聯繫表格
我現在需要使它的功能,但對PHP 0知識。我已經嘗試了許多不同的PHP代碼,但我甚至不知道如何將html文件正確鏈接到.php文件。我的代碼如下,如果有人可以告訴我如何鏈接文件,我會如此感激!
HTML:
<div id="form-main">
<div id="form-div">
<form class="form" id="form1" action="mail.php" method="post">
<p class="name">
<input name="name" type="text" class="validate[required,custom[onlyLetter],length[0,100]] feedback-input" placeholder="Name" id="name" />
</p>
<p class="email">
<input name="email" type="text" class="validate[required,custom[email]] feedback-input" id="email" placeholder="Email" />
</p>
<p class="text">
<textarea name="text" class="validate[required,length[6,300]] feedback-input" id="comment" placeholder="Comment"></textarea>
</p>
<div class="submit">
<input type="submit" value="SEND" id="button-blue"/>
<div class="ease"></div>
</div>
</form>
</div>
腓
<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
{
//send email
$from = $_REQUEST['author'] ;
$to = $_REQUEST['email'] ;
$subject = $_REQUEST['subject'] ;
$message = $_REQUEST['msg'] ;
mail($to, $subject, $message, "From:" . $from);
// the mail was sent
echo "Thank you for using our mail form";
}
else {
//if "email" is not filled out, display the form
//just close php and copy the code for your form
?>
你的'mail.php'文件在哪裏? –
'action'屬性告訴表單發送數據的位置。因此'action =「mail.php」'將表單的數據發送到名爲'mail.php'的腳本。你是否製作該文件並填充它? – chris85
你做了什麼樣的嘗試?什麼不按預期工作?目前你的問題基本上是「教我PHP」,這對於堆棧溢出來說太遠了。 – David