Php 在没有新页面的情况下刷新页面
因此,我有以下代码用于aside,它允许用户搜索其他用户(注意:为了使代码更可读,我在这里省略了aside标记):Php 在没有新页面的情况下刷新页面,php,html,Php,Html,因此,我有以下代码用于aside,它允许用户搜索其他用户(注意:为了使代码更可读,我在这里省略了aside标记): 如果将$refresh设置为0,则不需要If。因为它总是0。这样做: <?php if(isset($_POST['chat-submit'])) { echo '//here goes the chat-form but this is too long for this comment. But its the same as above'; } else {
如果将$refresh设置为0,则不需要If。因为它总是0。这样做:
<?php
if(isset($_POST['chat-submit'])) {
echo '//here goes the chat-form but this is too long for this comment. But its the same as above'; }
else {
echo $output;
}
?>
所以它现在可以工作了这是@Dieter Kräutl的正确解决方案:
您如何发送请求?它是AJAX还是direct?@DieterKräutl不,它只是direct。你可以发布用来替换$output的代码吗?我是指实际替换它的位置。@DieterKräutl$output应该替换为if语句中的代码。因此,当您单击chat submit(=inside$output)时,应加载聊天。的确,它加载了表单,但我知道上一个表单中的搜索框和搜索按钮仍然在那里。向我展示您如何替换$output。