HTML文本框发送到txt文件

时间:2014-02-21 20:03:43

标签: html

你好我有一个虚假的网站,我想获取HTML代码,从文本框发送信息到txt文件..就像FaceBook假页面放一些编辑。

这是我的代码:

<table width="306px" cellspacing="0" cellpadding="0" border="0" style="padding-top: 24px;">
<tbody>
    <tr>
        <td class="login_txt" width="105">
            <img align="absmiddle" src="https://nximage.nexoneu.com/en/button/bl_arrow3.gif"></img><b></b>

        </td>
        <td width="142" align="left">
            <input id="txtLogin0" class="input_login input_login_id" type="text" tabindex="1" autocomplete="off" maxlength="50" onkeydown="" name="txtLogin0"></input>
        </td>
        <td width="69" align="right" rowspan="3">
            <input id="btnLogin" type="image" align="absmiddle" onclick="javascript:if( $.trim(document.getElementById('txtLogin0').value) == ''){ alert('Please enter your NEXON Europe ID.'); document.getElementById('txtLogin0').focus(); return false;} else if ( $.trim(document.getElementById('txtPassword0').value) == ''){ alert('Please enter your password.');return false;}  else if (($.trim(document.getElementById('hdIsCaptcha').value) == 'true') &&( $.trim(document.getElementById('txtCaptchaText').value) == '')){ alert('Type in the characters you see in the picture below.');return false;};" src="https://nximage.nexoneu.com/en/login/login_btn01.gif" tabindex="3" name="btnLogin"></input>
        </td>
    </tr>
    <tr>
        <td height="6" colspan="2"></td>
    </tr>
    <tr>
        <td class="login_txt"></td>
        <td align="left">
            <input id="txtPassword0" class="input_login" type="password" tabindex="2" autocomplete="off" name="txtPassword0"></input>
        </td>
    </tr>
    <tr>
        <td></td>
        <td class="login_txt" height="36" align="left" colspan="2">
            <label for="chkSaveID">
                <input id="chkSaveID" type="checkbox" onclick="javascript:if( document.getElementById('chkSaveID').checked == true){ alert('Please uncheck if you are using a shared computer.');}" style="vertical-align: middle;" value="1" name="chkSaveID"></input>Remember ID</label>
        </td>
    </tr>
    <tr id="captchaimgtr" style="display: none;"></tr>
    <tr>
        <td height="3" colspan="2"></td>
    </tr>
    <tr id="captchatext" style="display: none;"></tr>
</tbody>

请帮助;(

1 个答案:

答案 0 :(得分:1)

用于将文本框值/内容保存到* .txt文件的PHP代码

$my_file = 'file.txt';
$handle = fopen($my_file, 'w') or die('Cannot open file:  '.$my_file);
$data = $_POST['nameOfTxtBox']; //<input name="nameOfTxtBox">
fwrite($handle, $data);

P.S。 你需要包装文本框并在标签内提交按钮并设置动作,然后用$ _POST处理数据(我提供的第三行代码)