我有基本的问题,但似乎无法找到问题。我有一个简单的HTML表单,我无法工作(甚至不能去google.com),所以我想知道你是否可以看到我在这里找不到任何明显的错误。
<form action="www.google.hr" id="questionForm" method="post">
<fieldset>
<legend>Naputci za studente:</legend>
<textarea name="help" id="help"><?php print($result['Help']); ?></textarea><br><br>
<input type="submit" value="Update" id="create"/>
</fieldset>
</form>
谢谢大家的帮助,不幸的是没有任何帮助解决这个问题所以它必须是其他困扰这部分代码的东西。再一次,我赞美你所有的帮助。
编辑:
我正在浏览谷歌浏览器开发工具,似乎它没有“读取”表格线,无论如何我有截图,所以这里是?
答案 0 :(得分:3)
尝试使用action="www.google.hr"
进行action="http://www.google.hr"
以及
<form action="http://www.google.hr" id="questionForm" method="post">
<fieldset>
<legend>Naputci za studente:</legend>
<textarea name="help" id="help"><?php print($result['Help']); ?></textarea>
<br><br>
<input type="submit" value="Update" id="create"/>
</fieldset>
</form>
正如帕特里克在他的回答中所说,也可以应用GET,而不是POST,这将采用所有值,并将字面意思放在URL中。
如果我将此表格更改为GET,则会发送此网址:
https://www.google.hr/?help=%3Cbr+%2F%3E%0D%0A%3Cb%3ENotice%3C%2Fb%3E%3A++Undefined+variable%3A+result+in+%3Cb%3EC%3A%5Ccode%5COpdrachten+Bram%5CPHPStorm%5CKeyword+Density+Tool%5Cretrieve_url.php%3C%2Fb%3E+on+line+%3Cb%3E87%3C%2Fb%3E%3Cbr+%2F%3E%0D%0A
无论如何,如果我将动作属性更改为something.php
,例如。然后点击提交按钮,它会直接转到something.php,它会发布或获取。所以你的表格是正确的。我认为你应该在你的代码中查看其他地方。
答案 1 :(得分:1)
两个问题:
http://
; Google不接受跨域帖子。试试get
:
<form action="http://www.google.com/" id="questionForm" method="get">
<fieldset>
<legend>Naputci za studente:</legend>
<textarea name="q" id="q"></textarea><br><br>
<input type="submit" value="Update" id="create"/>
</fieldset>
</form>
在本地文件上测试,因为jsfiddle会阻止这种请求。