gpt4 book ai didi

php - 如何填充我的文本框?

转载 作者:行者123 更新时间:2023-11-29 21:27:06 27 4
gpt4 key购买 nike

我正在为实习制作一个网站,但遇到了一个问题。将数据从我的数据库检索到我的文本框中。如果可能的话,每个人都有自己的信息。例如;我有一个给约翰的文本框,他有姓名和电子邮件。 jack 也有姓名和电子邮件。两者都需要从数据库中选择并放入表单中。您可以在该表单中更改人员信息。你可以自己看看网站 here 。单击“Wijzig”按钮查看我指的表格。

<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</head>
<tr>
<td width="100">
<div id="flip">
<img src="images/ik.jpg" class="circular" width="100px" height="100px">
<td width="350px">
<label for="luca" style="width: 280px;">Luca Fraser</label>

<div id="panel" style="display: none;">Geboortedatum: 30-12-1997
<br>Email: lucaf1997@gmail.com
<br>Woonplaats: Winterswijk
</div>
</td>
</div>
</td>
<td>
<label for="luca">Voorzitter</label>
</td>
<td style="border-color: transparent;">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModalNorm" style="background-color: #42a5f5; border-color: #42a5f5; margin-left: 20px;">Wijzig
</button>
<div class="modal fade" id="myModalNorm" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">&times;</span>
<span class="sr-only">Close</span>
</button>
<h4 class="modal-title" id="myModalLabel">
Wijzigen
</h4>
</div>

<!-- Modal Body -->
<div class="modal-body">
<form role="form">

<div class="form-group">
<label for="exampleInputEmail1">Voornaam</label>
<input type="email" class="form-control" id="exampleInputEmail1" value="Here needs to get a input value, look at line 247 to see where it needs to be." />
</div>

<div class="form-group">
<label for="exampleInputEmail1">Achternaam</label>
<input type="email" class="form-control" id="exampleInputEmail1" placeholder="Janssen" />
</div>

<div class="form-group">
<label for="exampleInputEmail1">Email</label>
<input type="email" class="form-control" id="exampleInputEmail1" placeholder="jan@janssen.nl" />
</div>

<div class="form-group">
<label for="exampleInputPassword1">Telefoonnummer</label>
<input type="text" class="form-control" id="exampleInputPassword1" placeholder="0612345678" />
</div>

<div class="form-group">
<label for="exampleInputEmail1">Functie</label>
<input type="email" class="form-control" id="exampleInputEmail1" placeholder="Voorzitter" />
</div>
</form>
</div>

<!-- Modal Footer -->
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">
Close
</button>
<button type="button" class="btn btn-primary">
Save changes
</button>
</div>
</div>
</div>
</div>


</td>
<td style="border-color: transparent;">
<button type="button" class="btn btn-danger" onclick="myFunction()">Verwijder</button>
</td>
</tr>

最佳答案

您需要编写 jquery 代码来从标签或 DOM 元素获取值并显示在相应的输入框中。

value = $("#labelid").val();

但是您需要使您的 HTML 标准化,例如为标签使用唯一的 id。

关于php - 如何填充我的文本框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35455497/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com