Is it possible to "call" a JavaScript function though php, like if I were to do somthing like this:

<?php

//Skip to code that calls javascript

$thisvariable = 1;

if($thisvariable == 1){
?>

<script language="javascript">
auto();
function auto(){
document.form.submit();
}
</script>

<?php
}

//Continue php code...

Would that be the best way, and does it work correctly?

    I just remembered something.... what if I also had the php check from a sql database for any type of change every few seconds... say like the example before, where $thisvariable changes in the database and the php catches it and checks if it equals 1 then calls.... would that help or all... or did that not make any difference?

      can php submit an html form automatically? or something in replace to my exapmle before? because if it can... I wont have any reason to use JavaScript in my program.

      and how would i use the "onload" or any other "on"-something to either submit a form or control the client?

        Originally posted by evan18h
        can php submit an html form automatically? or something in replace to my exapmle before? because if it can... I wont have any reason to use JavaScript in my program.

        Getting the server to do something on the client

        and how would i use the "onload" or any other "on"-something to either submit a form or control the client?

        Consult a Javascript reference or forum.

          Write a Reply...