[英]Writing form input in .txt using Php
How do I duplicate form boxes and the codes in my php to "grab the newly added form boxes"? 如何复制表格框和PHP中的代码以“抓住新添加的表格框”? I'm planning to create 4 form boxes (email, password, contact, Bio) but I'm already stuck on the second one.
我打算创建4个表单框(电子邮件,密码,联系方式,简历),但我已经陷入了第二个表单框。 codes:
代码:
<form action="#" method="post">
<input type="text" name="email" class="emailSubmitSidebar" placeholder=" Your Email">
<input type="text" name="password" class="password" placeholder="Password">
<input type="submit" name="submit" class="submitButton">
</form>
<?php
if(isset($_POST["submit"]))
{
$fileHandle = fopen('info.txt', 'w+')
OR die ("Can't open file\n");
$email=$_POST["email"];
$password=$_POST["password"];
$result = fwrite ($fileHandle, $email, $password);
if ($result)
{
print '<script type="text/javascript">';
print 'alert("Email added!")';
print '</script>';
} else {
print '<script type="text/javascript">';
print 'alert("Email not added!")';
print '</script>';
};
fclose($fileHandle);
}
?>
PHP code keeps failing, direct fix for this? PHP代码不断失败,为此直接解决?
Change this line: 更改此行:
$result = fwrite ($fileHandle, $email."-".$password);
fwrite
takes a single string a parameter, you can't pass two parameters fwrite
使用单个字符串的一个参数,不能传递两个参数
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.