我通过表单发送输入的内容,从第1页至第2页,使用按钮与action="page2.php"
:
<form method="get" id="chatform" action="page2.php">
<input type="text" style="margin-bottom:20px;" class="form-control" id="recipient" name="recipient" placeholder="username" value="">
</form>
按钮的形式外,但它包含它的名称:
<button type="submit" form="chatform" id="b9" style="font-size: 12px !important;" name="b9" class="buttonmenu toggleForms btn btn-secondary btn-block" style="float:left;">Chat</button>
我也很loadind使用javascript输入:
$(".buttonmenu").click(function(){
$('#recipient').val("hellooooo"); }
问题是,一切工作正常Safari浏览器,但在Firefox我不戈t变量$_GET['recipient']
中的任何内容,我不明白为什么。
在page1中只有表格串联,没有嵌套froms。在Safari中,一切都在第2页完美运行:我在URL和内容中获得了'收件人'变量的名称,在firefox中,我只在URL中获得'收件人'变量的名称,但变量为空 看来就像Firefox无法从服务器获取$_GET['recipient']
的内容,或者运行php操作IGNORING javascript。
有什么想法?
'动作= “chat.php”''VS行动= “使page2.php”'...所以...而且也没有提交按钮 –
道歉,它是action =“page2.php” - 只需在问题 – giuseppe
中纠正它,你如何将表单发送到该页面? –