我的项目中有一个问题,我无法修复。
我正在使用MySQL - PHP,一切正常,但是当我尝试打开" php/consult.php?consult=add
"使用下面的表格。
<form action="php/consult.php?consult=add" method="get">
<td>Instruccion SQL:</td>
<td>
<input type="text" name="codecosult" required/>
</td>
</form>
我的浏览器没有将网址更改为&#34; php / consult.php?consult = add&#34;。相反它只显示&#34; php / consult.php&#34;,我做错了什么? 感谢您的回答和时间,对不起我的英语(xD不太好)。
答案 0 :(得分:0)
如果提交了此作品 - 您不需要添加查询字符串 - 如果它是<a href="...
,那么您需要网址的完整查询字符串:
<form action="php/test.htm" method="get">
<td>Instruccion SQL:</td>
<td>
<input type="text" name="codecosult" required/>
</td>
<input type="submit" name="submit" value="Submit" />
</form>
这给了我my url + /php/test.htm?codecosult=ghrth&submit=Submit
ghrth
就是我输入的内容。
如果您使用脚本提交,请将查询字符串关闭并让&#34; GET&#34;方法处理它 - 这里的脚本是在头脑中。
<script language="javascript">function submit_this(){this.form.submit();}</script>
</head>
<body>
<form name="form" id="form" action="php/test.htm" method="GET">
<td>Instruccion SQL:</td>
<td>
<input type="text" name="codecosult" id="codecosult" required/>
</td>
<div onClick="submit_this();">Submit</div>
这给了我my url + test.htm?codecosult=dfthwrth
dfthwrth
就是我输入的内容。
虽然每次按下某个键时都会通过按键事件修改<a href="...
&#39; href
,但这种情况也有效:(可能无法在所有浏览器中使用):
<input type="text" name="codecosult" onKeyPress="ahreff.href='php/test.htm?'+this.value;" required/>
<a href="#" id="ahreff">Click Here</a>
这可能是有意义的 - 下拉列表将以相同的方式传递其值:
dropdown menu doesn't function - 现在就可以了!