我可能是业余爱好者的问题,但问题出在这里:
我正在尝试使用随附的图像示例输入来建立与oracle 12c数据库的连接。尽管代码很简单,但我仍然无法收回任何东西。更具体地说,PHP脚本不会运行,而是在我的浏览器中出现一个弹出窗口,要求保存getbooks.php
PHP
$conn = oci_connect("username", "password", "orcl");
if (!$conn) {
$m = oci_error();
echo $m['message'], "\n";
exit;
}
else {
print "Connected to Oracle!";
}
oci_close($conn);
?>
HTML
<center><button class="searchbutton" onclick="showform()">Search
Book</button></center>
<form id="form2" action="getbook.php">
<div class="container">
<div id="theForm2">
<div class="BG2" >
<center><p style="text-align: center;color:white;"> Search for a Book by Author Name </p>
<input type="text" id="query"></input>
<input onclick="showbook()"type="Submit" value="Submit" id="Submit2"></center>
<button onclick="closeform()" style="background-color:red; border:solid,border-width:1px; border-color:white; color:white">X</button>
<p id="temp"></p>
</div>
</div>
</form>
JavaScript
document.getElementById('Submit2').addEventListener('click',showbook());
function showform(){
var element = document.getElementById("theForm2");
element.style.display = "block";
}
function closeform(){
var element = document.getElementById("theForm2");
element.style.display = "none";
}
function showbook(){
var str = document.forms["form2"]["query"].value;
var xhttp;
xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("temp").innerHTML = this.responseText;
}
};
xhttp.open("GET", "getbook.php?q="+str, true);
xhttp.send();
}
我想查看echo“ bruh”查询的结果,以便可以确定php脚本已执行,然后,我希望程序打印“ Connected to Oracle!”