当用户通过文本字段填写了一些信息时,我在服务器上生成新页面时遇到了一些问题。我希望它将信息保存在我的服务器上的html文件中,html的名称取自标题框。有没有什么方法可以将整个div复制到一个新页面上,以便它存储它?我在这方面完全是个新手,但希望有人有时间帮忙。
我的html是这样的:
<div class="form-style-10">
<h1>Create a new guide for others to view<span>Be specific and precise when creating your guide</span></h1>
<form>
<div class="section"><span>✔</span>Give your guide a name</div>
<div class="inner-wrap">
<label>Please start with "How do" or "How to" <input type="text" name="title" /></label>
</div>
<div class="section"><span>✔</span>Step 1</div>
<div class="inner-wrap">
<label><input type="text" name="field1" /></label>
</div>
<div class="section"><span>✔</span>Step 2</div>
<div class="inner-wrap">
<label><input type="text" name="field2" /></label>
</div>
<div class="section"><span>✔</span>Step 3</div>
<div class="inner-wrap">
<label><input type="text" name="field3" /></label>
</div>
<div class="section"><span>✔</span>Step 4</div>
<div class="inner-wrap">
<label><input type="text" name="field4" /></label>
</div>
<div class="section"><span>✔</span>Step 5</div>
<div class="inner-wrap">
<label><input type="text" name="field5" /></label>
</div>
<div class="button-section">
<input type="submit" name="Sign Up" />
<span class="privacy-policy">
<input type="checkbox" name="field6">You agree to our Terms and Policy.
</span>
</div>
尝试使用PHP制作表单。这里有一个很棒的教程:http://www.w3schools.com/php/php_forms.asp,使用制作新文件
$newfile = fopen("example.html", "w")or die("Couldn't open file.");
并使用写入
fwrite($newfile, "Hello world!");
顺便说一句,不要忘记使用关闭文件
fclose($newfile);
希望我帮忙;)