您将数据从浏览器传递到服务器。Javascript是一种用于操纵浏览器的语言。PHP是您的服务器端语言。
您可以在获取或发布请求中传递数据,例如“ mypage.php?Username = john”
您想要的是一种表单,以便您可以与用户进行交互
<script type="text/javascript"> function insertIntoDb() { document.getElementById("myform").submit(); //or if you want to use jquery and ajax $.post("insert.php", $("#myform").serialize()); return false; }</script><form id="myform" method="post" action="insert.php"> <a href="#" onclick="insertIntoDb();">INSERT MY USERNAME</a> <input type="text" name="Username"></input></form>


