<?php require './../dao.php'; session_start(); if (!isset($_SESSION["user"])) { header("location:../index.php"); } $user = $_SESSION["user"]; $types = findExerciseTypes(); $res = false; $flag = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { $typeid = trim_input(filter_input(INPUT_POST, "typeid")); $count = trim_input(filter_input(INPUT_POST, "num")); $totaltime = trim_input(filter_input(INPUT_POST, "totaltime")); $date = trim_input(filter_input(INPUT_POST, "date")); $comment = trim_input(filter_input(INPUT_POST, "comment")); $res = addExercieRecord($typeid, $count, $totaltime, $date, $comment, $user["id"]); if ($res) { $flag = "记录添加成功"; } else { $flag = "记录添加失败"; } } ?> <html> <head> <meta charset="utf-8"> <link href="../css/bootstrap.min.css?v=3.4.0" rel="stylesheet"> <link href="../font-awesome/css/font-awesome.css?v=4.3.0" rel="stylesheet"> <link href="../css/animate.css" rel="stylesheet">
<?php require './../dao.php'; ?> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body> <?php $json = json_encode(findExerciseTypes()); ?> <script type="text/javascript"> var json=eval('(<?php echo $json; ?> )'); for(var o in json){ alert(json[o].typename); } </script> </body> </html>