我的问题是是否有一种方法,例如在单击提交按钮后将内容发送到电子邮件以执行相同的操作,但创建一个包含所有信息的.txt
文件或.doc
文件,就像它是电子邮件一样。每次有人点击“提交”时,我真的需要创建一个包含信息的文档,这样我就不会感到困惑。
为了更清楚,请输入data > submit >
仅包含该信息的文件夹中的创建文件。
谢谢。
这是我的代码:
<?php
<form name="form1" action="test3.php" method="post" onSubmit="return validate(this);">
<table width="100%" >
Please enter your Sudent ID: <INPUT TYPE = "Text" VALUE ="" NAME = "studentid"><br />
<br />
Please select the category that you want to receive on your moval.edu e-mail account.<br /><br />
<b>Athletics:</b><br><br />
<b>MEN'S</b><br />
<input type=checkbox name=footb >Football<br>
<input type=checkbox name=bball >Baseball<br>
<input type=checkbox name=basket >Basketball<br>
<input type=checkbox name=cheer >Cheer<br>
<input type=checkbox name=xcountry >Cross Country<br>
<input type=checkbox name=golf >Golf<br>
<input type=checkbox name=lax >Lacrosse<br>
<input type=checkbox name=rodeo >Rodeo<br>
<input type=checkbox name=socc >Soccer<br>
<input type=checkbox name=tennis >Tennis<br>
<input type=checkbox name=track >Track<br>
<input type=checkbox name=volleyb >Volleyball<br>
<input type=checkbox name=wrestl >Wrestling<br><br />
<b>WOMEN'S</b><br />
<input type=checkbox name=wbasket >Basketball<br>
<input type=checkbox name=wcheer >Cheer<br>
<input type=checkbox name=wxcountry >Cross Country<br>
<input type=checkbox name=dance >Dance<br>
<input type=checkbox name=wgolf >Golf<br>
<input type=checkbox name=wlax >Lacrosse<br>
<input type=checkbox name=wrodeo >Rodeo<br>
<input type=checkbox name=wsocc >Soccer<br>
<input type=checkbox name=softb >Softball<br>
<input type=checkbox name=wtennis >Tennis<br>
<input type=checkbox name=wtrack >Track<br>
<input type=checkbox name=wvolleyb >Volleyball<br>
<input type=checkbox name=wwrestl >Wrestling<br><br />
<b>STUDENT AFFAIRS ACIVITIES</b><br><br />
<input type=checkbox name=sudentaff > Sign me up for Student Affairs Activities<br /><br />
<b>INTERNAIONAL CLUB ACTIVITIES</b><br /><br />
<input type=checkbox name=intclub > Sign me up for International Club Activities<br /><br />
<b>HISTORICAL ACTIVITIES</b><br><br />
<input type=checkbox name=history > Sign me up for Hisorical Activities<br /><br />
<b>CONTESTS</b><br><br />
<input type=checkbox name=contests > Sign me up for Contests<br /><br />
<b>LIBRARY EVENTS</b><br><br />
<input type=checkbox name=libevents > Sign me up for Library Evens<br /><br />
<b>VIKING EXCHANGE</b><br /><br />
<input type=checkbox name=vikexch > Sign me up for Viking Exchange News<br /><br />
</table>
<script type="text/javascript"
src="http://www.google.com/recaptcha/api/challenge?k=6LdiAugSAAAAAKzj8jQeUTm4dsYINvJICQIEbenc">
</script>
<noscript>
<iframe src="http://www.google.com/recaptcha/api/noscript?k=6LdiAugSAAAAAKzj8jQeUTm4dsYINvJICQIEbenc"
height="300" width="500" frameborder="0"></iframe><br>
<textarea name="recaptcha_challenge_field" rows="3" cols="40">
</textarea>
<input type="hidden" name="recaptcha_response_field"
value="manual_challenge">
</noscript>
<input name="cmd_submit" type="submit" id="submit" value="Submit" />
</form>
?>
<?php
require_once('recaptchalib.php');
$privatekey = "6LdiAugSAAAAAL6unDYarZoKPYHGHgta6lp30vG0";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
// What happens when the CAPTCHA was entered incorrectly
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
} else {
// Your code here to handle a successful verification
header("Location: test41.php");
}
?>
<?php
if ($formSubmitted) {
$fh = fopen('J:\Off_IT\Internships\info.txt', 'a');
foreach($formData as $data) {
fwrite($data . "\n");
}
}
?>
第一个是有形式的,第二个是第一个的动作。