[英]How to pass values from javascript to PHP and then passing to an oracle database as an integer
Hi I have a problem passing values from javascript to PHP(in a separate file) 嗨,我在将值从javascript传递到PHP时遇到问题(在单独的文件中)
function checked(){
var length = document.getElementById("Options").length;
alert(length);
for(var i = 0; i < length - 1; i++){
if(document.getElementById(i).checked){
var selectedId = i;
var slecetedValue = document.getElementById(i).value;
}
}
}
These are the variables calculated in the javascript function. 这些是在javascript函数中计算出的变量。 But I need to pass them to a seperate php file to send them to an ORACLE database (hopefully as integers).
但是我需要将它们传递到单独的php文件中,以将它们发送到ORACLE数据库(希望是整数)。 How exactly can I fix this problem?
我该如何解决这个问题呢?
Also, how exactly can I send a an integer to an oracle database cause oci_by_name normally sends a varchar but I need a Number. 另外,我如何才能将整数发送到oracle数据库,因为oci_by_name通常会发送varchar,但我需要一个Number。
PS. PS。 I know there are examples online but I don't really understand could you give me an example ?
我知道网上有例子,但我不太了解,您能举个例子吗?
Thanks you 谢谢
You would use AJAX. 您将使用AJAX。 Here is a good starting point with an example of JavaScript sending data to a PHP script running on the server.
这是一个很好的起点,以JavaScript将数据发送到服务器上运行的PHP脚本为例。 W3Schools
W3学校
Or you could submit the html form to the server and pass the data to a PHP script as is answered in this stackoverflow question 或者,您可以将html表单提交到服务器,然后将数据传递给PHP脚本,如本stackoverflow 问题中所述
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.