-
foreach($lst_nice as $nice) : ?>
endforeach; ?>
-
foreach($lst_naughty as $naughty) : ?>
endforeach; ?>
include "_db.php"; //connect db $db = connect_mysql("192.168.224.41", "dev", "dev", "holidays"); // check if posted -- add if it's the case if (isset($_POST['from_post']) && isset($_POST['name']) && isset($_POST['liste']) ) { $name = mysql_real_escape_string(trim($_POST['name'])); $is_on_list = mysql_real_escape_string($_POST['liste']); $ip = mysql_real_escape_string($_SERVER['REMOTE_ADDR']); $created_at = mysql_real_escape_string(date('YmdHis')); $sql = "INSERT INTO ecard_2012(name, is_on_list, ip_address, created_at) VALUES ('{$name}','{$is_on_list}','{$ip}','{$created_at}')"; $result = mysql_query($sql,$db); header("Location: ".$_SERVER['PHP_SELF']); } // Get nice list $sql = "SELECT * FROM ecard_2012 WHERE is_on_list='nice' ORDER BY created_at DESC"; $lst_nice = mysql_to_array(mysql_query($sql, $db)); // Get naughty list $sql = "SELECT * FROM ecard_2012 WHERE is_on_list='naughty' ORDER BY created_at DESC"; $lst_naughty = mysql_to_array(mysql_query($sql, $db)); mysql_close($db); ?>