【发布时间】:2020-02-11 02:53:34
【问题描述】:
function message() {
$connection=mysqli_connect("localhost","root","","halcondentalclinic");
var s = document.getElementById('edit_otherValue');
if (s=="Crown") {
<?php
$try18s=="Crown";
$db="INSERT INTO tooth1(treatment)VALUES('$try18s')";
$db_run=mysqli_query($connection,$db);
?>
}
}
<input type=text name=edit_otherValue id=edit_otherValue value="" />
<button onclick="message()" type="submit" name="treatmenthistoryupdatebtn" class="btn btn-primary">Save</button>
如何根据输入值使用javascript在MySQL中插入数据 我只是 javascript 的初学者。
【问题讨论】:
-
您不能使用 vanilla javascript 将数据插入数据库。您可以改用 nodejs,它是一个支持各种数据库的 javascript 编译器。
-
别担心!如果您真的喜欢 javascript,这里有一个链接可以让您开始使用 nodejs 中的数据库。 link
标签: javascript html mysql