【问题标题】:Form placement in a div [closed]div中的表单放置[关闭]
【发布时间】:2012-09-08 05:54:42
【问题描述】:

我尝试创建一个几乎涵盖我页面所有内容的表单。由于输入字段是分散的,因此它会验证但之后仍会进入下一页。我不知道问题是什么;当我离线尝试它时,它在 HTML 和 PHP 格式中运行良好。当我将它上传到服务器时会出现问题。

脚本:

<form method="post" action="step.php" id="form1">
<div id="content">
<center>
<br><br><br>
      <input  id="sig" name="sig" type="text" class="validate[sign] text-input" style="margin-left:-180px;visibility:hidden;height:0px;"/>


    <div id="signatureparent">
    <div id="signature"></div>
    </div>
</div>

</center>

<!====================================================================================>




<div id="content">
<div id="wrapper">
<div id="form-div">
<center><strong>Please enter the information for the person who will be the primary contact for our account set up team. If left blank we will use the information in the billing section.</strong></center>
<div id="wrapper3">
<div id="form-div">

<center>
<table cellpadding='0' cellspacing='27'>
<tr>
<td>
<!====================================================================================>
<div style="display:none">
<label for="name"><strong>First Name<font color=red size=3> *</font></strong></label>
      <p class="name">
         <input name="name" readonly="readonly" type="text" class="validate[custom[name]] text-input" id="Name" value="<?php echo $_POST["name"]; ?>" />

      </p>
<label for="last" style="margin-left:45px;"><strong>Last Name<font color=red size=3> *</font></strong></label>
      <p class="last">
         <input name="last" style="margin-left:45px;" readonly="readonly" type="text" class="validate[custom[last]] text-input" id="last" value="<?php echo $_POST["last"]; ?>" />

      </p>
</div>

<!====================================================================================>
<label for="cname"><strong>First Name<font color=red size=3> *</font></strong></label>
      <p class="cname">
         <input name="cname" type="text" class="validate[custom[cname]] text-input" id="cname" value="" />
        </p>

<label for="cemail"><strong>E-mail<font color=red size=3> *</font></strong></label>
      <p class="cemail">
        <input name="cemail" type="text" class="validate[custom[cemail]] text-input" id="cemail" value=""  />

      </p>

<!====================================================================================>
</td><td>

<label for="clast" style="margin-left:45px;"><strong>Last Name<font color=red size=3> *</font></strong></label>
      <p class="clast">
         <input name="clast" style="margin-left:45px;"  type="text" class="validate[custom[clast]] text-input" id="clast" value="" />

      </p>

<label for="cphone" style="margin-left:45px;"><strong>Phone<font color=red size=3> *</font></strong></label>
      <p class="cphone">
        <input type="text" class="validate[custom[mob]] text-input" name="cphone" id="cphone"  style="margin-left:45px;width:100px" /> 

 <b>ext</b><input style="width:25px; margin-left:5px;" type="text" class="validate[custom[ext]] text-input" name="cext1" id="cext1" />
        </p>

</td><td>


<!====================================================================================>   
<label for="ccom" style="margin-left:45px;"><strong>Company<font color=red size=3> *</font></strong></label>
      <p class="com">
        <input type="text" class="validate[custom[ccom]] text-input"name="ccom" id="ccom" onblur="this.value = this.value.toTitleCase();" style="margin-left:45px;" />
      </p>

<label for="cmob" style="margin-left:45px;"><strong>Mobile#</strong></label>
      <p class="mob">
        <input type="text" class="validate[custom[mob]] text-input" name="cmob" id="cmob" style="margin-left:45px;width:100px;" /> 


<b>ext</b><input style="width:25px; margin-left:5px;" type="text" class="validate[custom[ext]] text-input" name="cext2" id="cext2" />
        </p>

</div></div></div></div></div>
</center>
</td></tr></table>

<div>

<!====================================================================================>
<br>
<div id="wrapper">
<div id="form-div">

<table><tr><td><div style="margin-left:210px;" >
<p><font color=red size=2%><b>Clicking this button means that you accept the terms and conditions of our service  </b></font></td><td>
<div id="accept"><button style="margin-left:10px;border: 0; background: transparent" type="submit"><img src=img/acept.png height=30 /></button>
 </div>
</tr></td></table>
</div>
</div>  
<br><br><br>

</form>

它应该首先验证内容,然后继续。

【问题讨论】:

  • 现在这些都没有任何意义
  • 我知道吗?毫无意义
  • 我大致记得最初的问题,所以有点道理,但对于第一次来的人来说不会
  • 删除了因未知原因被否决的内容?
  • 也许发布代码本身。像这样的外部链接往往会勾引一些人,如果你得到它们(客户端或服务器端)会发布任何错误

标签: php html forms validation verify


【解决方案1】:

您的表单在提交时似乎没有运行任何代码。您希望您的表单具有:

<form method="post" action="step.php" id="form1" onsubmit="return validate()">

这是假设您的验证代码是 JavaScript 函数。

【讨论】:

    猜你喜欢
    • 2012-05-11
    • 2012-03-21
    • 1970-01-01
    • 2012-05-17
    • 1970-01-01
    • 2023-01-12
    • 1970-01-01
    • 1970-01-01
    • 2013-05-23
    相关资源
    最近更新 更多