0

Hi I have a problem passing values from javascript to PHP(in a separate file)

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. But I need to pass them to a seperate php file to send them to an ORACLE database (hopefully as integers). 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.

PS. I know there are examples online but I don't really understand could you give me an example ?

Thanks you

3
  • What examples do You not understand? Commented Apr 22, 2015 at 2:05
  • I actually just got this code window.location.href = "localhost/project/delete.php?selectedId=" + selectedId + "&selectedOption=" + selectedOption; and worked just fine. But I have a problem passing an integer into an ORACLE database instead of a varchar any ideas? Commented Apr 22, 2015 at 2:10
  • I think It would be better to delete this question and write new about inserting integer from PHP into Oracle. Or find it. Commented Apr 22, 2015 at 2:20

1 Answer 1

0

You would use AJAX. Here is a good starting point with an example of JavaScript sending data to a PHP script running on the server. W3Schools

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

Sign up to request clarification or add additional context in comments.

3 Comments

I actually found this window.location.href = "localhost/project/delete.php?selectedId=" + selectedId + "&selectedOption=" + selectedOption;
But do you have any idea how can I pass an integer into an ORACLE DATABASE?
When the data is passed to the PHP script, you could use the PHP function intval to get the integer that you pass on to the Oracle DB in your query. php.net/manual/en/function.intval.php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.