2015-12-08 81 views
0

当用户通过文本框填写了一些信息时,我在我的服务器上生成一个新页面时出现了一些问题。 我希望它将信息保存在我的服务器上的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> 

+0

为什么不尝试使用PHP?当你陷入困境时显示你的PHP,我们将从那里帮助你。 –

+0

有太多可能的答案,或者这个格式的答案太长。请添加详细信息以缩小答案集或隔离可在几个段落中回答的问题。我建议您找到一个开发论坛(也许[Quora](http://www.quora.com/Computer-Programming) )?)来计算一般性。然后,当/如果您有特定的编码问题,请回到StackOverflow,我们很乐意提供帮助。 –

回答

0

尝试制作了使用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); 

希望我帮忙;)