我有一個問題,我是新手,我不認爲我很瞭解,我應該怎麼做呢?顯示從頁面的消息到另一個使用PHP和HTML表單
我有3個文件,contact.html,mail.php,afisare.php!
contact.html
<form class="uk-form uk-form-stacked" method="post" action="mail.php">
<div class="uk-form-row">
<label class="uk-form-label">Your Name</label>
<div class="uk-form-controls">
<input type="text" name="nume" placeholder="" class="uk-width-1-1">
</div>
</div>
<div class="uk-form-row">
<label class="uk-form-label">Your Email</label>
<div class="uk-form-controls">
<input type="text" name="email" placeholder="" class="uk-width-1-1">
</div>
</div>
<div class="uk-form-row">
<label class="uk-form-label">Your Message</label>
<div class="uk-form-controls">
<textarea name="mesaj" class="uk-width-1-1" id="form-h-t" cols="100" rows="9"></textarea>
</div>
</div>
<div class="uk-form-row">
<div class="uk-form-controls">
<button class="uk-button uk-button-primary">Submit</button>
</div>
</div>
</form>
mail.php
<?php
$admin_email = "serban[email protected]";
$nume = $_POST['nume'];
$email = $_POST['email'];
$mesaj = $_POST['mesaj'];
if (!$nume ||!$email||!$mesaj) die ("Completati toate campurile!");
else {
echo "Numele: ".$nume."<br>";
echo "E-mail: ".$email."<br>";
echo "Mesaj: ".$mesaj."<br>";
echo "<p>Salut ".$nume."!<br>Mesajul tau: "".$mesaj."" a fost trimis la adresa ".$email.".</p>";
}
mail($admin_email, "Formular contact", $mesaj, "De la".$email);
?>
afisare.html
<div class="uk-vertical-align uk-text-center uk-height-1-1">
<div class="uk-vertical-align-middle" style="width: 250px;">
<img class="uk-margin-bottom" width="140" height="120" src="images/logo.jpg" alt="">
<form class="uk-panel uk-panel-box uk-form">
<div class="uk-form-row">
<input class="uk-width-1-1 uk-form-width-large" type="text" placeholder="Nume">
</div>
<div class="uk-form-row">
<input class="uk-width-1-1 uk-form-width-large" type="text" placeholder="Email">
</div>
<div class="uk-form-row">
<input class="uk-width-1-1 uk-form-width-large" type="text" placeholder="Mesaj">
</div>
</form>
</div>
</div>
什麼,我想我做的s顯示在afisare.html,來自的信息contact.html使用mail.php。
而我很困惑...我不認爲我完全理解我能做到這一點!
解釋你的意思是顯示聯繫。聯繫人只是一個html文件,它不是由任何東西填充? – clearshot66
Contact.html是一個頁面,我完成的信息,如發件人的電子郵件,發件人名稱和發件人的郵件,我想打印這些在afisare.html使用mail.php ... –
它並不真的那樣工作...你可以將contact.html表單的行爲設置爲afisare,發送這些$ _POST變量,然後通過包含它來運行mail.php? – clearshot66