PHP表单模板echo到JS到HTML

HTML用JS去PHP获取数据,这些都做好了。
但是,PHP有表单模板用echo输出,经过JS到HTML,HTML上正常浏览,可以得不到变量,就是index.php?id = ".$id." 这样得不到数据。
下面是代码:
echo "<form action='index.php?id='$id'' method='post'>";
echo "<input class='ui input focus' name='pname' id='pname' placeholder='".$uname."' type='text'>";
echo "<button class='ui blue basic button' onClick='return isName()'>提交</button>";
echo "</form>";
能正常输出到HTML,但在HTML提交表单之后另一张PHP得到数据是空的

下面的语句有问题:
echo "<form action='index.php?id='$id'' method='post'>";
建议修改为:
echo "<form action='index.php?id=$id' method='post'>";
温馨提示:答案为网友推荐,仅供参考