Home >Backend Development >PHP Tutorial >PHP FORM中如何实现通过用户选择,将结果提交到不同的页面

PHP FORM中如何实现通过用户选择,将结果提交到不同的页面

WBOY
WBOYOriginal
2016-06-23 14:20:56810browse

php select

目的: 通过用户对下拉框选项的不同选择,将整张表的数据提交到不同的页面,通过百度等搜索到的结果,好像只要将选择项的值设定为目的网页就行,但我按这个方法设置后却没有成功,求各位大神出手相助。

如下想实现的功能是,用户选择相应的类别,如电脑,并输入EMAIL后提交,就能转到computer.php页面

<form action="" method="get" name="form1" class="form js">  <fieldset>  <h1>填表</h1>  <div class="quick-fields">      <label>你想去的店铺</label>      <div class="quick-field-name">	  	<select name="storeid" id="storeid" >			<option value="">-请选择-</option>			<option value="bedcloth.php">床上用品</option>			<option value="computer.php">电脑</option>			<option value="mobile.php">手机</option>		</select>        </div>        <label>State</label>      <div class="quick-field-name">        <input type="text" name="emailaddress" placeholder="请填写电子邮件" id="emailaddress" />		</select>           </div>    </div>      <input type="submit" name="commit" value="提交" />          </fieldset></form>

回复讨论(解决方案)

<scrip>$('#storeid').change(function(){  $("form").attr('action',$(this).val());});</script>

<scrip>$('#storeid').change(function(){  $("form").attr('action',$(this).val());});</script>


注意引用jquery

应该修改form的action

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn