php 通过超链接触发事件提交表单

/*

php是不可以直接触发事件的(新手,应该是吧???),所以,PHP事件触发有2种;

1.表单form post传递。

2.通过js,jaxa间接调用php。

作为一个新手,我有需要在这里补充些知识点,看 http://localhost/index.php?id=321 该地址有一个问号,问号的作用或者意思:就是传递问号后面的参数id=321。

通过以下代码,可以在网页中显示出来:

<?php
 echo $_GET["id"];
?>

*/

问:

<form name="headerForm" action="mail.php" method="post">
 <div >
  <input type="text" name="email"  value="" />
 </div>
 <a href="">提交</a>
</form>
通过以上方式,我提交表单用连接的形式,不支持button、submit提交表单。怎么才能将表单里面 email的内容传给mail.php?
<--!                      --                    -->
最佳答案
<script language="JavaScript">
function cheak()
  {
  var i=headerForm.email.value;
window.location='mail.php?name='+i;
  }
</script>

<form name="headerForm" action="mail.php" method="post">
 <div >
  <input type="text" name="email"  value="" />
 </div>
 <a onclick="cheak()" href="#">提交</a>
</form>
转自:http://zhidao.baidu.com/question/174551015.html
posted @ 2011-12-23 09:51  stma  阅读(4894)  评论(0)    收藏  举报