is it possible in php java scrip and jquery that we give a condition and redirect page to another pages on depending on those condition like
if($id==1)
{
    header(location:page1.php);
}
else
{
header(location:page2.php);
}
the value of id comes from database.
something like that using jc jquery enything please help its argent.

Recommended Answers

It is possible, In jquery

exg:

<script type="text/javascript">
$(function(){
<?php
    if($id==1)
    {
?>
        window.location="page1.php";
<?php
    }
    else
    {
?>
        window.location="page2.php";
<?php    
    }
    ?>
});
</script>
Jump to Post

All 2 Replies

It is possible, In jquery

exg:

<script type="text/javascript">
$(function(){
<?php
    if($id==1)
    {
?>
        window.location="page1.php";
<?php
    }
    else
    {
?>
        window.location="page2.php";
<?php    
    }
    ?>
});
</script>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.