大家早上好,新年快樂!:)
我最近開始使用免費的網站模板修改 HTML。
準確地說是這個:https : //html5up.net/strata
我一直試圖找到一種方法來使這個確切的“留言”框作業,但我還沒有發現這個特定機制背后的整個邏輯。
https://prnt.sc/25kej6d
這是 HTML 代碼塊(使用 Visual Studio 代碼)
https://prnt.sc/25kf7s2
<!-- Three -->
<section id="three">
<h2>Get In Touch</h2>
<p><h4>Email me with any questions or inquiries. I would be happy to answer all your questions & set up a meeting with you.</h4></p>
<div class="row">
<div class="col-8 col-12-small">
<form method="post" action="#">
<div class="row gtr-uniform gtr-50">
<div class="col-6 col-12-xsmall"><input type="text" name="name" id="name" placeholder="Name" /></div>
<div class="col-6 col-12-xsmall"><input type="email" name="email" id="email" placeholder="Email" /></div>
<div class="col-12"><textarea name="message" id="message" placeholder="Message" rows="4"></textarea></div>
</div>
</form>
<ul class="actions">
<li><input type="submit" value="Send Message" /></li>
uj5u.com熱心網友回復:
使用表單向處理資料并嘗試發送電子郵件的 PHP 腳本提交查詢的基本示例。下面首先使用form屬性將按鈕與表單相關聯,PHP 嘗試使用該mail功能,該功能可能在您的虛擬主機上可用,也可能不可用。
<section id="three">
<h2>Get In Touch</h2>
<p><h4>Email me with any questions or inquiries. I would be happy to answer all your questions & set up a meeting with you.</h4></p>
<div class="row">
<div class="col-8 col-12-small">
<form name="mailer" method="post" action="/path/to/mailhandler.php">
<div class="row gtr-uniform gtr-50">
<div class="col-6 col-12-xsmall"><input type="text" name="name" id="name" placeholder="Name" /></div>
<div class="col-6 col-12-xsmall"><input type="email" name="email" id="email" placeholder="Email" /></div>
<div class="col-12"><textarea name="message" id="message" placeholder="Message" rows="4"></textarea></div>
</div>
</form>
<ul class="actions">
<!-- associate the button to the form using the `form` attribute -->
<li><input form="mailer" type="submit" value="Send Message" /></li>
</ul>
以及action在表單的屬性中指定的郵件處理目標腳本。
<?php
# mailhandler.php
if( $_SERVER['REQUEST_METHOD']=='POST' && isset(
$_POST['name'],
$_POST['email'],
$_POST['message']
)){
ob_clean();
$args=array(
'name' => FILTER_SANITIZE_ENCODED,
'email' => FILTER_SANITIZE_EMAIL,
'message' => FILTER_SANITIZE_ENCODED
);
$_POST=filter_input_array( INPUT_POST, $args );
extract( $_POST );
$to='[email protected]';
$subject='An enquiry';
$headers=array(
'From' => $email
);
$message=array(
'Sender' => $email,
'Name' => $name,
'Message' => $message
);
$status=@mail( $to, $subject, implode('\r\n',$message), implode('\r\n',$headers) );
exit( header( sprintf('Location: ?mailsent=%s',$status ) ) );
}
?>
這是一個非常簡單的例子,如果沒有修改和增強,可能不應該使用,但可能會說明您需要做什么。
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/399980.html
標籤:javascript html css
上一篇:字串中有空格,但我無法在powershell中拆分它
下一篇:從HTML中的元素中洗掉特定類
