<?php 

//session_start();
include("connection.php")

?>




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Hedgeis-market</title>
<link href="market css.css" rel="stylesheet" type="text/css" />

<link rel="stylesheet" type="text/css" href="jquery-ui.css">
  <script src="jquery-1.8.3.js"></script>
  <script src="jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css" />
  <!-- <link href="marnet_internal_css.css" rel="stylesheet" type="text/css" /> -->
  <script>
  $(function() {
    $( "#accordion" ).accordion();
  });
  </script>



<script language="javascript" type="text/javascript">
function resizeIframe(obj)
{
obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
 obj.style.width = obj.contentWindow.document.body.scrollWidth + 'px';                       
}
</script>


</head>

<body>


<!--contant start-->
<form method="post">
  <?php include('header2.php');?>
<div class="Contant_wrapper clearfix">
 <div class="topdiv">
        <div class="view">
        <ul>
        <li>View</li>
        <li><a href="#">latest</a></li>
        <li><a href="#">Current Prices</a></li>
        <li> <a href="#">Charts</a></li>
        </ul>
        </div>
    </div>

    <!--contant_left start-->
    <div class="contant_left">

        <a href="market.php">Most Active Today </a>
        <div class="sub_menu">
        </div>
        </div>
     <div id="accordion">


        <?php

 $query1= "SELECT * from `category`";
 $result5 = mysql_query($query1);
   while($row1=mysql_fetch_array($result5))

              {

   $cate_name=$row1['category_name'];
   $cate_id=$row1['category_id'];

  ?> 
<!-- <h3>Section 1</h3> -->

 <h3><a href="category_link_step1.php?cate_id=<?php echo $cate_id?>" class="see">
        <?php echo"$cate_name";?></a></h3>


        <div>
       <?php 
$query1= "SELECT * from `sub_category` where `category_id`='$cate_id'";
$result1 = mysql_query($query1);
while($row2=mysql_fetch_array($result1))

             {

           $sub_name=$row2['subcatogory_name'];
           $sub_id=$row2['sub_id']

  ?> 

 <p><a href="subcategory_link.php?sub_id=<?php echo $sub_id?>" class="show"><?php echo $sub_name;?></a></p>
 <?php }?>
</div>

    <?php }?>

</div>

     </div>

    <!--contant_left end-->

 <!--contant_right start   -->

<div class="contant_right clearfix">
  <div class="field clearfix">
          <?php 

$query1= "SELECT * from `event`";

$result = mysql_query($query1);

     while($row1=mysql_fetch_array($result))
{ 
      $url=$row1['image'];
      $cate_name=$row1['category_id'];
      $sub_name=$row1['sub_id'];
      $des=$row1['event_description'];
      $eve=$row1['event_title'];



  ?>  
      <div class="images">   
        <img src="cat_image/<?php echo $url; ?>" width="90px" height="90px"></div>
        <div class="information"> 
        <h3><a href="prediction1.php"><?php echo "$eve";?></br></a></h3> 
        Event:<a href="prediction1.php"><?php echo "$des";?></a></div>
       <div class="rating">
       </div>
        <?php } ?> 
    </div>


 <div class="field clearfix">
          <?php 

$query1= "SELECT * from `sub_event`";

$result = mysql_query($query1);

     while($row1=mysql_fetch_array($result))
{ 
      $url1=$row1['image'];
      $cate_name1=$row1['category_id'];
      $sub_name1=$row1['sub_id'];
      $sub_name1=$row1['event_id'];
      $des1=$row1['sub_evt_description'];
      $eve1=$row1['sub_evt_title'];



  ?>  
      <div class="images">   
        <img src="subevent/<?php echo $url1; ?>" width="90px" height="90px"></div>
        <div class="information"> 
        <h3><a href="prediction1.php"><?php echo "$des1";?></br></a></h3> 
        Event:<a href="prediction1.php"><?php echo "$eve1";?></a></div>
       <div class="rating">
       </div>
        <?php } ?> 
    </div>

</div>

</div>
</div>
<div style="clear:both"></div>
<?php include('footer1.php');?>
<!--contant end-->

</form>
</body>
</html>

Dani AI

Generated

Short version: the anchor in your accordion header is navigating the page before the accordion can do its work. You can either stop the link and load the target URL into an iframe when the panel opens, or intercept the header link click, prevent the default navigation, open the panel programmatically and then set the iframe src. wants both "expand submenu" and "load page in iframe"; was right to suggest using jQuery selectors and e.preventDefault().

Option A — store the URL on the header and load it when the panel activates (no real href needed):

<div id="accordion">
  <h3 data-url="/category.php?id=123">Category name</h3>
  <div>submenu markup</div>
</div>

<iframe id="sideFrame" name="sideFrame" style="width:100%;height:400px;border:0"></iframe>

<script>
$("#accordion").accordion({
  collapsible: true,
  heightStyle: "content",
  activate: function(event, ui) {
    var url = ui.newHeader && ui.newHeader.data("url");
    if (url) { $("#sideFrame").attr("src", url); }
  }
});
</script>

Option B — keep an anchor but intercept the click, prevent default, set the iframe and open the panel:

<h3><a class="open" href="/category.php?id=123">Category name</a></h3>

<script>
$("#accordion").on("click", "h3 a.open", function(e){
  e.preventDefault();
  var $h = $(this).closest("h3");
  var idx = $("#accordion > h3").index($h);
  $("#accordion").accordion("option", "active", idx);
  $("#sideFrame").attr("src", $(this).attr("href"));
});
</script>

Troubleshooting notes: make sure each header is immediately followed by its panel (h3 then div) — jQuery UI needs that structure. Include jQuery before jQuery UI and check the browser console for errors. If the iframe load fails, check server headers (X-Frame-Options) which can block embedding. If you need bookmarks, store the open panel in the hash or use history.pushState when you change the iframe src.

Recommended Answers

All 4 Replies

Hii every one

I am getting problem to giving link in accord offollowing page...if imgiving link the acord scriptisnt working ...any other way i can do it plzz suggest.??

<h3><a href="category_link_step1.php?cate_id=<?php echo $cate_id?>" class="see">
<?php echo"$cate_name";?></a></h3>

does it show any errors?

show what html exactly is generated in

<div id="accordion">

(use inpect element to do that)

no it not showing any error i just want to 2 task on one link
1 is showing sub menu
2 is rediredting to iframe.

so you have somewhow to identify.
I don't know that accordion thing.
But what I would try - use jqury selector. On acordiaon click - somehow identiry the 1 - if its 1 then let the acordion to show submenu.

Otherwise if its 2 - maybe e.preventDefault would work so preventing expanding acordion and do other code (redirecty in your case).

So the first thing - you need identify what user wants.
Secodn - you need to stop acordion from expanding.

MAybe acordion plugin has some callback on click or something liek that.

Be a part of the DaniWeb community

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