第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

刷新網(wǎng)頁(yè)后,表單數(shù)據(jù)嘗試重新發(fā)送

刷新網(wǎng)頁(yè)后,表單數(shù)據(jù)嘗試重新發(fā)送

PHP
牛魔王的故事 2023-07-08 20:28:58
我并不真正使用 PHP,而且這樣做超出了我的能力范圍。我正確設(shè)置了 XAMPP 及其“sendmail”文件夾,以便我可以從我創(chuàng)建的網(wǎng)站發(fā)送電子郵件。電子郵件會(huì)發(fā)送給該人,但問(wèn)題是,每當(dāng)我第一次發(fā)送郵件后嘗試刷新時(shí),網(wǎng)頁(yè)都會(huì)告訴我“您正在查找您輸入的已使用信息的頁(yè)面。返回到該頁(yè)面可能會(huì)導(dǎo)致您所采取的任何行動(dòng)被重復(fù)”。因此,如果我單擊“繼續(xù)”,頁(yè)面會(huì)刷新,但郵件會(huì)再次發(fā)送。我嘗試使用標(biāo)頭進(jìn)行重定向,但它并沒(méi)有真正起作用。我收到一條錯(cuò)誤,指出“無(wú)法修改標(biāo)頭信息 - 標(biāo)頭已發(fā)送”。我也嘗試過(guò)一些AJAX功能但沒(méi)有成功。我真的無(wú)法理解這個(gè)問(wèn)題,我現(xiàn)在非常感謝一些幫助這是我的表單 HTML        <form method="post" action="#" class="contact-form" autocomplete="off">            <div class="row">                <div class="col span-1-of-3">                    <label for="name">Name</label>                </div>                <div class="col span-2-of-3">                    <input type="text" name="name" id="name" placeholder="Your name" required>                </div>            </div>            <div class="row">                <div class="col span-1-of-3">                    <label for="email">Email</label>                </div>                <div class="col span-2-of-3">                    <input type="email" name="email" id="email" placeholder="Your email" required>                </div>            </div>            <div class="row">                <div class="col span-1-of-3">                    <label for="find-us">How did you find about us?</label>                </div>                <div class="col span-2-of-3">                    <select name="find-us" id="find-us">                        <option value="friends" selected>Friends</option>                        <option value="search">Seach Engine</option>                        <option value="other">Other</option>                    </select>                </div>            </div>            <div class="row">                <div class="col span-1-of-3">                    <label>Newsletter</label>                </div>                <div class="col span-2-of-3">                    <input type="checkbox" name="newsletter" id="newsletter" checked>Yes, please                </div>            </div>
查看完整描述

1 回答

?
HUWWW

TA貢獻(xiàn)1874條經(jīng)驗(yàn) 獲得超12個(gè)贊

您需要使用POST/REDIRECT/GET 模式將用戶重定向到另一個(gè)頁(yè)面或同一頁(yè)面以避免這種情況。發(fā)送303 HTTP 響應(yīng)將告訴瀏覽器替換其歷史記錄中的該頁(yè)面,并避免重新發(fā)送已發(fā)布的數(shù)據(jù)。


if (mysqli_query($connection, $register)) {

? ? if(isset($_POST['sendmail'])){

? ? ? ? mail($_POST['email'], 'Store' , 'Thanks for the message '.$_POST['name'].' !');

? ? ? ? header('Location: index.php', true, 303);

? ? ? ? exit;

? ? }

? ? else {

? ? ? ? // Handle error

? ? }

}

這是一個(gè)非常基本的例子。您將需要為調(diào)用添加錯(cuò)誤檢查/處理,mail()因?yàn)樗赡軙?huì)失敗。您還應(yīng)該有某種消息傳遞方式讓用戶知道電子郵件已發(fā)送。


查看完整回答
反對(duì) 回復(fù) 2023-07-08
  • 1 回答
  • 0 關(guān)注
  • 192 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)