Php 创建一个提交表单按钮,该按钮对自定义验证码/代码字段作出反应
我有以下表格Php 创建一个提交表单按钮,该按钮对自定义验证码/代码字段作出反应,php,html,Php,Html,我有以下表格 <form action="/wp-content/themes/wallstreet/welcome.php" method="post" class="basic-grey"> <h1>Form <span>Please fill all the texts in the fields.</span> </h1> <label> <span>Your Nickname* :&l
<form action="/wp-content/themes/wallstreet/welcome.php" method="post" class="basic-grey">
<h1>Form
<span>Please fill all the texts in the fields.</span>
</h1>
<label>
<span>Your Nickname* :</span>
<input id="name" type="text" name="name" placeholder="It will appear " />
</label>
<label>
<span>Your Email* :</span>
<input id="email" type="email" name="email" placeholder="Valid Email Address" />
</label>
<label>
<span>Message* :</span>
<textarea id="messagebook" name="messagebook" placeholder="The text that will appear "></textarea>
</label>
<label>
<span>Code* :</span>
<input id="code" type="text" name="email" placeholder="The Code That we sent to your email" />
</label>
<label>
<span> </span>
<input type="submit" class="button" value="Send" />
</label>
形式
请填写字段中的所有文本。
你的昵称*:
您的电子邮件*:
信息*:
代码*:
如您所见,它与PHP一起工作,PHP将表单提交到txt文件
<?php
$var = $_POST['messagebook'];
file_put_contents("/var/www/wordpress/wp-content/themes/wallstreet/data.txt", $var . "\n", FILE_APPEND);
exit();
?>
我的目的是存储一个TXT文件,它将存储1000个唯一的代码,比如
AD23A ASSD5 FJLQQ AS223 AS544。。。(等等)
txt格式将与上述相同
那么,我想用这段代码做点什么
<label>
<span> </span>
<input type="submit" class="button" value="Send" />
</label>
因此,只有当字段中的代码与我的.txt文件中的代码一致时,“提交”按钮才会起作用
<?php
$var = $_POST['messagebook'];
file_put_contents("/var/www/wordpress/wp-content/themes/wallstreet/data.txt", $var . "\n", FILE_APPEND);
exit();
?>