Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/472.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在PHP数组中使用Jquery隐藏_Php_Javascript_Jquery - Fatal编程技术网

在PHP数组中使用Jquery隐藏

在PHP数组中使用Jquery隐藏,php,javascript,jquery,Php,Javascript,Jquery,我试图使用一个函数来显示php数组中的添加信息。我在回显显示我的类信息的表,而我无法在PHP中使用Jquery。我在Jquery或PHP方面不是最有经验的,所以我一定是把它完全搞错了 编辑:我知道我的PHP查询是不安全的,我最终已经开始转换这些查询。 这是我的密码 <link rel="stylesheet" type="text/css" href="css/bigcalendar.css"> <!DOCTYPE html> <html> <hea

我试图使用一个函数来显示php数组中的添加信息。我在回显显示我的类信息的表,而我无法在PHP中使用Jquery。我在Jquery或PHP方面不是最有经验的,所以我一定是把它完全搞错了

编辑:我知道我的PHP查询是不安全的,我最终已经开始转换这些查询。 这是我的密码

<link rel="stylesheet" type="text/css" href="css/bigcalendar.css">

<!DOCTYPE html>
<html>

<head>
    <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />

    <title>Webbook | View Schedule</title>

    <link rel='stylesheet' type='text/css' href='css/style.css' />

    <!--[if IE]>
      <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
    <script type='text/javascript' src='js/jquery.ba-hashchange.min.js'></script>
    <script type='text/javascript' src='js/dynamicpage.js'></script>
    <script>
$(document).ready(function(){
  $("button").click(function(){
    $("#hidetest").toggle(1000);
  });
});
</script>
</head>

<body>

    <div id="page-wrap">

        <header>
                 <?php include "navbar.php";?>

        </header>

        <section id="main-content">
        <div id="guts">

          <h2>View Schedule</h2>

<?php
//get database settings
include("dbinfo.php");

?>



<div align="center">
<?php
$sqlschedule = mysql_query("SELECT * FROM schedule WHERE student='Austin' ORDER BY `hour`  ASC");
$num_rows = mysql_num_rows($sqlschedule);
//Table starting tag and header cells
while($row = mysql_fetch_array($sqlschedule)){
   //Display the results in different cells
   $hour = $row['hour'];
   $class = $row['class'];
   $teacher = $row['teacher'];
   $classid = $row['classid'];


$sqlclassid = mysql_query("SELECT * FROM classes WHERE classid=$classid");
while($row2 = mysql_fetch_array($sqlclassid)){
$hour2 = $row2['hour'];
$class2 = $row2['class'];
$teacher2 = $row2['teacher'];
}
if($class == ""){
$class = $class2;
}
if($teacher == ""){
$teacher = $teacher2;
}

$sqlhourinfo = mysql_query("SELECT * FROM hours WHERE hour='$hour'");
while($row3 = mysql_fetch_array($sqlhourinfo)){
$starttime = strftime("%l:%M %P", strtotime($row3['starttime']));
$endtime = strftime("%l:%M %P", strtotime($row3['endtime']));
}
/*
$from = mysql_query("SELECT * from members WHERE username='$fromuser'");
$num_rows = mysql_num_rows($from);
//Table starting tag and header cells
while($row = mysql_fetch_array($from)){
   //Display the results in different cells
   $otherid = $row['id'];
   $theusername = $row['username'];
}
*/



echo '<p>This is a paragraph with little content.</p>
<p style="display:none" id="hidetest">This is another small paragraph.</p>
<button>Toggle</button>
';
   echo '     
<table id="background-image" width="50%" border="0" cellspacing="5" cellpadding="10">
  <tr>
    <th width="10%" rowspan="2" class="scheduleform" scope="col">'.$hour.'</th>
    <td align="left" scope="col">'.$class.'</td>
  </tr>
  <tr>
    <td align="left">'.$teacher.'</td>
  </tr>
  <tr>
    <td colspan="2"><p>Starts: '.$starttime.'<br>
      Ends: '.$endtime.'
    </p></td>
    </tr>
<tr>
<td>
<a href="#" id="opener">
<img border="0" src="/webbook/images/256.png" alt="Add Assignment" width="32" height="32"></a>
</td>
<td>
<a href="#">
<img border="0" src="/webbook/images/256 (1).png" alt="Edit Assignment" width="32" height="32"></a>
</td>

</tr>
</table>







      </p>

';

}

?>

      </div>

</div>
</div>


        </div>
        </section>

    </div>

    <footer>
      &copy;2013 iHeff Webbook
    </footer>
    <?php   /* 
include('../footer.php'); 
*/ ?>
</body>

</html>

Webbook |查看明细表
$(文档).ready(函数(){
$(“按钮”)。单击(函数(){
$(“#隐藏测试”)。切换(1000);
});
});
查看明细表
链接的id为“opener”,但您正在使用
(“按钮”)。请单击(
…等


使用
$(“#opener”)。改为单击
。这会将单击功能绑定到链接。

您只需将
显示:无
设置到表单容器,注册一个单击侦听器,然后使用jquery.show()弹出表单。以下是一个示例:

<a href="#" id="addassgn">Add Assignment</a>
<div id="assgnform" style="display:none">
    <h1>Assignment Form</h1>
    Name: <input type="text"/><br/>
    Class: <input type="text"/><br/>
    File: <input type="text"/><br/>
    <input type="submit"/>
</div>

$('#addassgn').click(function() {
    $('#assgnform').show();
});

任务表
名称:
类别:
文件:
$('#addassgn')。单击(函数(){ $('#assgnform').show(); });

使用php生成所有html。将其显示到页面上。一旦它出现在页面上,您就可以在页面上使用javascript。谢谢您的回答。您能给我举个例子吗?我有点困惑您的意思。将php生成的html和javascript发布到JSFIDLE,这样我们就可以看到它在为qui做什么了ck响应,但现在该链接与我遇到的问题无关。抱歉,我在问题中弄糊涂了。现在我只是尝试用按钮和

一旦我弄明白了,我会把它移到链接上并更改标记。谢谢你的回复,但这对我也不起作用。我点击链接,什么也没发生。我知道它是独立的,但一旦我尝试将它放在我的代码中,在PHP部分,它就不会起作用。