English 中文(简体)
如果提交书失败,如何防止重发html表格
原标题:how to prevent html form reset if submit is unsuccessful

我正在使用一种表格在我的网站上对用户进行登记,并在网站上设置一个上限。 一切都行之有效,但我面临的唯一问题是,如果一进入错误的帽子或某页的复读,用户输入的所有数据就会被抹去。

我所希望实现的是,即使所进入的上限是错误的,而且提交表格的形式,表格中的所有领域都应与被填充的用户一道,排除了上限。

如何做到这一点? 我的表格是html,处理页是php。

最佳回答

您可以填写<代码> 数值 您形式投入的属性;

<input type="text" name="username" value="<?php 
  if (!empty($_POST[ username ])) { 
    echo htmlspecialchars($_POST[ username ]); 
  }?>" 
/>
问题回答

你们需要把形式行动定在目前的网页上。 只要有错误,就会打上同样的文字,这一文字可以填写其他答复中描述的形式价值。 只有在成功的情况下,你才会将用户转向另一页。





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签