-2

i have setup an overlay script to enable me to display an overlay popup so to speak, it works great, because i cna call it from a button etc... However i want to be able to see if the user has come to the page with a subid present in their header, if not, then i want the overlay to appear.

Here is the code where the overlay needs to be called from

    if (isset($_GET['eid'])) {


 if ($_GET['eid'] == ""){
 // CALL THE overlay_choose_house from here
 } else{
     $estate_id = $_GET['eid'];
 }

} 

Here is the code that is being called

<script>
$(document).ready(function(){
$('#overlay_choose_house').bind('click', function(event){
    if (event.target == $('#overlay_choose_house').get(0))
        overlay_choose_house(); 
});
});
</script>

Thanks for any and all help

Al Hennessey
  • 2,395
  • 8
  • 39
  • 63
  • 1
    possible duplicate of [How to call a JavaScript function from PHP?](http://stackoverflow.com/questions/1045845/how-to-call-a-javascript-function-from-php) – outis Jun 24 '12 at 01:24

1 Answers1

2

One way to go:

<script>
    $(document).ready(function(){
        $('#overlay_choose_house').bind('click', function(event){
            if (event.target == $('#overlay_choose_house').get(0))
            overlay_choose_house(); 
        });

        <?php if ($_GET['eid'] == ""){ ?>overlay_choose_house();<?php } ?>

    });

Or this, replace:

// CALL THE overlay_choose_house from here

with

$x = true;

and than, as before:

<?php if ($x){ ?>overlay_choose_house();<?php } ?>
insertusernamehere
  • 23,204
  • 9
  • 87
  • 126