Jump to content

Calling jquery function within php


liomon41

Recommended Posts

I'm trying call a jquery function based if a condition in php is true but the problem is the jquery runs whether the condition is true or not... Need help fixing this.... Thanks...

 

 

 

<!doctype html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Show display...</title>

<script src="scripts/jquery-1.7.min.js" type="text/javascript"></script>

<style type="text/css">

.fadeOutbox{

float:left;

padding:8px;

margin:16px;

border:1px solid red;

width:200px;

height:50px;

background-color:#F00;

color:white;

}

 

</style>

</head>

 

<body>

 

<div class="fadeOutbox">

Click here to fadeOut div

</div>

 

 

<?php

 

 

ini_set("display_errors","0");

 

ERROR_REPORTING(E_ALL);

 

 

include 'config.php';

 

$query = "select secondteam from fixtures where id = '2' ";

 

$result = mysql_query($query);

 

while($row = mysql_fetch_array($result)) {

 

$country = $row['firstteam'];

 

 

 

 

if($country = "Poland"){ // by the way this happens to be false......

 

?>

       

    <script type="text/javascript">

 

 

$(".fadeOutbox").click(function () {

  $(this).fadeOut('slow');

});

 

</script>

 

       

       

        <?php

}

 

}

 

 

?>

</body>

</html>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.