如果我有一个包含链接的页面 <a href='edit_info.php?id=1001'>1001</a>
在 edit_info.php 页面上,我想使用 id 来查询数据库,例如
SELECT * FROM table WHERE id = $_GET['id']
现在我想用结果填充一堆文本字段。我必须在同一个 php 中完成这一切
('<?php //place all fields in an echo here ?>
)
或者有没有办法可以进行查询,然后在 html 中从查询中提取数据?
例如。
<?php //query and results here ?>
<html>
<body>
all my input fields w/ data here
</body>
</html>
最佳答案
您将使用查询中的值设置输入字段。
示例:
<input type="textbox" name="input_name" value="<?php print $valuefromquery; ?>">
关于php - 访问同一页面 HTML 中的 PHP 变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19992539/