
piano0011
Members-
Posts
189 -
Joined
-
Last visited
Recent Profile Visitors
2,076 profile views
piano0011's Achievements

Advanced Member (4/5)
0
Reputation
-
Hey guys! I am trying to do a drop right menu to add to my drop down menu and I almost got it but just can't seem to push the padding to the right of it... Here is my part of my html and css code:I put a div class there because I wasn't sure if I needed it but don't think so.... <!DOCTYPE html> <html> <head> <title></title> <meta charset="utf-8"> <link rel="stylesheet" type="text/css" href="style.css"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" integrity=">sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt" crossorigin="anonymous"> <link href="https://fonts.googleapis.com/css?family=Aldrich|Mr+Dafoe" rel="stylesheet"> </head> <body> <header> <nav> <ul> <li><a href="#">Member's section</a><div class="down"><i class="fas fa-caret-down"></i></div> <ul> <li><a href="index.php">Main Page</a></li> <li><a href="practice_diary.php">Practice diary</a></li> <li><a href="redeem.php">Redeem Your Points!</a></li> <li><a href="forum_main.php">Forum</a></li> <li><a href="quiz.php">Music Test</a></li> <li><a href="review.php">Review</a></li> <li><a href="update.php">Update Profile</a></li> <li><a href="#">Games</a> <div class="games"> <ul> <li><a href="guessing_game.php">Guessing Game</a></li> <li><a href="rock_paper_scissors.php">Rock, Paper, Scissors</a></li> </ul> </div> </li> </ul> </li> <li><a href="primer.php">Primer Level</a><div class="down"><i class="fas fa-caret-down"></i></div> <ul> <li><a href="level1.php">Level 1</a></li> <li><a href="level2.php">Level 2</a></li> <li><a href="level3.php">Level 3</a></li> </ul> </li> <li><a href="signup.php">Signup</a></li> <li><a href="refer.php">Referral page</a></li> <li><a href="reset.php">Reset Password</a></li> <li><a href="qa.php">More Information</a><div class="down"><i class="fas fa-caret-down"></i></div> <ul> <li><a href="contact.php">Contact Us</a></li> <li><a href="donation.php">Donation</a></li> <li><a href="activate.php">Activate Email</a></li> </ul> </li> <div class="profile_image"> <ul> <li><a href="uploadform.php">Upload Profile Picture</a></li> <div class="delete_profile"><li><a href="deleteprofile.php">Delete picture profile</a></li></div> </ul> </div> CSS code: header nav ul ul ul li{ position: absolute; display: none; } header nav ul ul li:hover ul li{ display: block ; position: relative; left: 200px; bottom: 100px; }
-
hey guys! I am trying to create a service section and I got it to work before but when I changed the border to make it wider, it doesn't seem to be side by side anymore. Here is my CSS and html file and what it is looking liked at the moment: <!DOCTYPE html> <html> <head> <title>PianoCourse101</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" type="text/css" href="style.css"> <link href="https://fonts.googleapis.com/css?family=Aldrich|Mr+Dafoe" rel="stylesheet"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" integrity=">sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt" crossorigin="anonymous"> <link href="https://fonts.googleapis.com/css?family=Pacifico" rel="stylesheet"> <link href="https://fonts.googleapis.com/css?family=Great+Vibes|Lobster" rel="stylesheet"> <link href="https://fonts.googleapis.com/css?family=Great+Vibes|Lobster|Monoton|Orbitron" rel="stylesheet"> </head> <body> </body> </html> <section class="main-container"> <div class="crotchet"> <p>𝅘𝅥</p> </div> <div class="minim"> <p>𝅗𝅥</p> </div> <div class="quaver"> <p>𝅘𝅥𝅮</p> </div> <div class="pc101"> </div> <div class="music"><i class="fas fa-music fa-8x"></i></div></span> <div class="sharp"><p>♯</p></div> <div class="natural"><p>♮</p></div> <div class="flat"><p>♭</p></div> <div class="main-wrapper"> <div class="title"> <br></br> <h1>Welcome to PianoCourse101</h1> </div> <br></br> </div> <div class="main-wrapper"> <div class="first"> <h2>At PianoCourse101, your child can now learn how to play Classical music right from the comfort of your own home! It doesn't matter if your child has no music foundation because there are lessons suitable for beginners and advanced students! Based on the "Bastien Piano Basics series", your child will be able to learn the basic hand positions, posture, finger numbers and letter names!<br></br> There are four levels in the "Bastien Piano Basics" series, beginning with the primer level, which is suitable for beginners. Once your child has completed the primer level, your child will be able to progress to Level 1, follow by Level 2 and Level 3.<br></br>Currently, PianoCourse101 lessons are mainly for children but we also encourage if you are an adult and also wish to learn how to play the piano to join us! In due course, there will also be lessons for adults!</h2> </div> </div> <div class="form"> <form class="signup-form" action="newsletters.php" method="POST"> <div class="newsletters"> <label><center>Enter your E-mail Address</center></label> </div> <br></br> <div class="index_form"><center><input type="text" name='email' placeholder="Enter E-mail Address"></center></div> <br></br> <center><button type="submit" name="submit">Subscribe to PianoCourse101!</button></center> <br></br> </form> </div> <img class="snoopy" src="includes/pictures/snoopy.jpg" alt="snoopy playing the piano" /> </section> <div class="services_main">Services</div> <div class="services"> <div class="service1"> <h1>Level 1</h1> <div class="image"> <a href="signup.php"><p>🎹</p></a> </div> <h3>Purchase the Level 1 Subscriptionplan!<br>Learn how to play the piano right from the comfort of your own home!<br>Monthly fee: $100<br>Yearly fee: $800</h3> </span> <div class="service1"> <h1>Level 2</h1> <div class="image"> <a href="signup.php"><p>🎻</p></a> </div> <h4>Purchase the Level 2 Subscriptionplan!<br>Learn how to play the piano right from the comfort of your own home!<br>Monthly fee: $150<br>Yearly fee: $1300</h4> </div> <div class="service1"> <h1>Level 3</h1> <div class="image"> <a href="signup.php"><p>🎷</p></a> </div> <h5>Purchase the Level 3 Subscriptionplan!<br>Learn how to play the piano right from the comfort of your own home!<br>Monthly fee: $200<br>Yearly fee: $1800</h5> </div> </div> <span class="index_views"><p>There are <?php echo "<span class='index_views_counter'> $views </span>";?> visitors who have visited <?php echo "<span class='index_views_counter'> $pagename </span>"; ?>!</p></span> </body> </html> This is my CSS code: div.service1 { width: 800px; border: 1px solid #c1c1c1; margin: 20px 50px; padding: 0 5px; float: left; } div.service1 > p { font-size: 14px; color: #000000; max-width: 250px; padding-top: 30px; text-align: justify; text-justify: inter-word; } div.services { width: 2500px; margin: 0 auto; } div.services h1 { font-size: 50px; font-weight: bold; background-color: #c1c1c1; color: #000000; padding: 10px 0; } div.image { max-width: 300px margin: 15px 0 0 0; padding-top: 30px; } div.image h3 { position: relative; bottom: 300px; } div.image h4 { position: relative; top: 200px; } div.services_main { text-align: center; font-size: 40px; color: #6495ED; margin: 100px 0 50px 0; font-family: 'Aldrich', sans-serif; font-family: 'Mr Dafoe', cursive ; } div.image:hover { opacity: 0.2; max-width: 200px; margin-top: 15px; }
-
Thanks guys and really appreciate the feedback!
-
Hey guys! This is a strange issue but I have been trying to implement a forum into my website and I know that i will always get problems when trying to follow someone's else but anyway, he has included the use of limit=1. For some reason, my other codes suddenly won't work and when I mean won't work, I mean that it will display multiple times like a loop unless I also use limit=1. Is this usually the case? Should I always use limit=1? to make sure that only 1 record is displayed?
-
Thanks guys.. appreciate it...
-
I got it to work but for some reason, I just have to move the footer.php to the bottom of the code..... I guess footer.php contains some html but how come the header.php can stay at the top?
-
Hey guys!I have the following error and I am not sure why because I thought that we could include the header.php and footer.php file at the top? I will include both my footer.php file and level.php: This is my footer.php file: <!DOCTYPE html> <html> <head> <title>Copyright 2018</title> <link rel="stylesheet" type="text/css" href="style.css"> <link href="https://fonts.googleapis.com/css?family=Aldrich" rel="stylesheet"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" integrity="sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt" crossorigin="anonymous"> </head> <body> <footer> <div class="copyright clearfix"> <div class="container clearfix"> <div class="text float left"> Copyright PianoCourse101 2018 </div> <ul class="links float right"> <li><a href=""><i class="fab fa-facebook-square"></i></a></li> <li><a href=""><i class="fab fa-twitter-square"></i></a></li> <li><a href=""><i class="fab fa-instagram"></i></a></li> <li><a href=""><i class="fab fa-youtube-square"></i></a></li> </ul> </div> </div> </footer> </body> </html> This is my level1.php file <!DOCTYPE html> <html> <head> <title></title> <meta charset="utf-8"> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <?php include_once 'header.php'; include_once 'footer.php'; $level1promo_expirydate = date('Y-m-d H:i:s', strtotime("+2 day")); $paidbydate = date('Y-m-d H:i:s', strtotime("+2 day")); $emailreminder = 1; $emailreminderreset = null; $subscriptionplandelete = null; $paidbydatedelete = null; $subscriptionplandatedelete = null; $expirydatedelete = null; $feemonthlysdelete = null; $feesyearlydelete = null; $paidreset = null; $totalfees = null; $overdue = 1; $overduereset = 0; $activatereset = 0; $level1promo_activate = 0; if(!isset($_SESSION['u_uid'])) { header("Location: index.php?level1=notlogin"); exit(); } else { include_once 'includes/dbh.php'; //Created a template $sql = "SELECT * FROM memberships WHERE user_uid = ?;"; //Create a prepared statement $stmt = mysqli_stmt_init($conn); //Prepare the prepared statement if (!mysqli_stmt_prepare($stmt, $sql)) { echo 'SQL statement failed'; } else { //Bind parameters to the placeholder mysqli_stmt_bind_param($stmt, "s", $_SESSION['u_uid']); //Run parameters inside database mysqli_stmt_execute($stmt); $result = mysqli_stmt_get_result($stmt); while ($row = mysqli_fetch_assoc($result)) { if ($row['subscriptionplan'] === 'Level 1' && $row['activate'] == 0 && $row['level1promo_activate'] == 0) { header("Location: update.php?level1=notactivated"); exit(); } else { if ($row['subscriptionplan'] === 'Level 1' && $row['activate'] == 1 && $row['emailreminder'] == 0 && $row['overdue'] == 0 && $row['paid'] == 0 && $row['feesmonthly'] != 0 && date("Y-m-d H:i:s") > $row['paidbydate']) { $company = "pianocourse101@hotmail.com"; $subject = "Level 1 monthly subscriptionplan payment is overdue: Please pay by the ".$paidbydate; $mailTo = $_SESSION['u_email']; $headers = "From: ".$company; $txt = "Hello ".$_SESSION['u_first']." ".$_SESSION['u_last']."! \n\n Your payment was due on the ".$row['paidbydate'].". It has now been extended to the following due date ".$paidbydate."\n\nPlease make sure that you have made your payment ASAP in order to access your Level 1 videos by the current due date. \n\nFailure to make payment will result in the cancellation of your Level 1 monthly subscriptionplan"; mail($mailTo, $subject, $txt, $headers); $sql = "UPDATE memberships SET paidbydate = ?, emailreminder = ?, overdue = ? WHERE user_uid = ? "; $stmt = mysqli_stmt_init($conn); //Prepare the prepared statement if (!mysqli_stmt_prepare($stmt, $sql)) { echo 'SQL statement failed'; } else { //Bind parameters to the placeholder mysqli_stmt_bind_param($stmt, "siis", $paidbydate, $emailreminder, $overdue, $_SESSION['u_uid']); //Run parameters inside database mysqli_stmt_execute($stmt); } header("Location: update.php?level1=overdue"); exit(); } else { if ($row['subscriptionplan'] === 'Level 1' && $row['activate'] == 1 && $row['emailreminder'] == 1 && $row['overdue'] == 1 && $row['paid'] == 0 && $row['feesmonthly'] != 0 && date("Y-m-d H:i:s") > $row['paidbydate']) { $company = "pianocourse101@hotmail.com"; $subject = "Level 1 monthly subscriptionplan payment has been cancelled!"; $mailTo = $_SESSION['u_email']; $headers = "From: ".$company; $txt = "Hello ".$_SESSION['u_first']." ".$_SESSION['u_last']."! \n\n Your payment was due on the ".$row['paidbydate'].". Your Level 1 monthly subscriptionplan has been cancelled because you have failed to make payment and already have received an email reminder! \n\nPlease subscribe again if you wish to access your Level 1 videos!"; mail($mailTo, $subject, $txt, $headers); $sql = "UPDATE memberships SET subscriptionplan = ?, subscriptionplandate = ?, feesmonthly = ?, expirydate = ?, paidbydate = ?, emailreminder = ?, overdue = ?, activate = ? WHERE user_uid = ? "; $stmt = mysqli_stmt_init($conn); //Prepare the prepared statement if (!mysqli_stmt_prepare($stmt, $sql)) { echo 'SQL statement failed'; } else { //Bind parameters to the placeholder mysqli_stmt_bind_param($stmt, "ssissiiis", $subscriptionplandelete, $subscriptionplandatedelete, $feemonthlysdelete, $expirydatedelete, $paidbydatedelete, $emailreminderreset, $overduereset, $activatereset, $_SESSION['u_uid']); //Run parameters inside database mysqli_stmt_execute($stmt); } header("Location: update.php?level1=cancelled"); exit(); } else { if ($row['subscriptionplan'] === 'Level 1' && $row['activate'] == 1 && $row['emailreminder'] == 0 && $row['overdue'] == 0 && $row['paid'] == 0 && $row['feesyearly'] != 0 && date("Y-m-d H:i:s") > $row['paidbydate']) { $company = "pianocourse101@hotmail.com"; $subject = "Level 1 yearly subscriptionplan payment is overdue: Please pay by the ".$paidbydate; $mailTo = $_SESSION['u_email']; $headers = "From: ".$company; $txt = "Hello ".$_SESSION['u_first']." ".$_SESSION['u_last']."! \n\n Your payment was due on the ".$row['paidbydate'].". It has now been extended to the following due date ".$paidbydate."\n\nPlease make sure that you have made your payment ASAP in order to access your Level 1 videos by the current due date. \n\nFailure to make payment will result in the cancellation of your Level 1 yearly subscriptionplan"; mail($mailTo, $subject, $txt, $headers); $sql = "UPDATE memberships SET paidbydate = ?, emailreminder = ?, overdue = ? WHERE user_uid = ? "; $stmt = mysqli_stmt_init($conn); //Prepare the prepared statement if (!mysqli_stmt_prepare($stmt, $sql)) { echo 'SQL statement failed'; } else { //Bind parameters to the placeholder mysqli_stmt_bind_param($stmt, "siis", $paidbydate, $emailreminder, $overdue, $_SESSION['u_uid']); //Run parameters inside database mysqli_stmt_execute($stmt); } header("Location: update.php?level1=overdue"); exit(); } else { if ($row['subscriptionplan'] === 'Level 1' && $row['activate'] == 1 && $row['emailreminder'] == 1 && $row['overdue'] == 1 && $row['paid'] == 0 && $row['feesyearly'] != 0 && date("Y-m-d H:i:s") > $row['paidbydate']) { $company = "pianocourse101@hotmail.com"; $subject = "Level 1 yearly subscriptionplan payment has been cancelled!"; $mailTo = $_SESSION['u_email']; $headers = "From: ".$company; $txt = "Hello ".$_SESSION['u_first']." ".$_SESSION['u_last']."! \n\n Your payment was due on the ".$row['paidbydate'].". Your Level 1 yearly subscriptionplan has been cancelled because you have failed to make payment and already have received an email reminder! \n\nPlease subscribe again if you wish to access your Level 1 videos!"; mail($mailTo, $subject, $txt, $headers); $sql = "UPDATE memberships SET subscriptionplan = ?, subscriptionplandate = ?, feesmonthly = ?, expirydate = ?, paidbydate = ?, emailreminder = ?, overdue = ?, activate = ? WHERE user_uid = ? "; $stmt = mysqli_stmt_init($conn); //Prepare the prepared statement if (!mysqli_stmt_prepare($stmt, $sql)) { echo 'SQL statement failed'; } else { //Bind parameters to the placeholder mysqli_stmt_bind_param($stmt, "ssissiiis", $subscriptionplandelete, $subscriptionplandatedelete, $feemonthlysdelete, $expirydatedelete, $paidbydatedelete, $emailreminderreset, $overduereset, $activatereset, $_SESSION['u_uid']); //Run parameters inside database mysqli_stmt_execute($stmt); } header("Location: update.php?level1=cancelled"); exit(); // Up to this point, the code is working } else { if ($row['subscriptionplan'] === 'Level 1' && $row['feesmonthly'] != 0 && $row['activate'] == 1 && $row['paid'] == 1 && date("Y-m-d H:i:s") > $row['expirydate']) { $company = "pianocourse101@hotmail.com"; $subject = "Level 1 monthly subscriptionplan payment has been cancelled!"; $mailTo = $_SESSION['u_email']; $headers = "From: ".$company; $txt = "Hello ".$_SESSION['u_first']." ".$_SESSION['u_last']."! \n\n Your payment was due on the ".$row['paidbydate'].". Your Level 1 monthly subscriptionplan has been cancelled because you have failed to make payment and already have received an email reminder! \n\nPlease subscribe again if you wish to access your Level 1 videos!"; mail($mailTo, $subject, $txt, $headers); $sql = "UPDATE memberships SET subscriptionplan = ?, subscriptionplandate = ?, feesmonthly = ?, paid = ?, expirydate = ?, paidbydate = ?, emailreminder = ?, overdue = ?, activate = ? WHERE user_uid = ? "; $stmt = mysqli_stmt_init($conn); //Prepare the prepared statement if (!mysqli_stmt_prepare($stmt, $sql)) { echo 'SQL statement failed'; } else { //Bind parameters to the placeholder mysqli_stmt_bind_param($stmt, "ssiissiiis", $subscriptionplandelete, $subscriptionplandatedelete, $feemonthlysdelete, $paidreset, $expirydatedelete, $paidbydatedelete, $emailreminderreset, $overduereset, $activatereset, $_SESSION['u_uid']); //Run parameters inside database mysqli_stmt_execute($stmt); } header("Location: update.php?level1=expired"); exit(); } else { if ($row['subscriptionplan'] === 'Level 1' && $row['feesyearly'] != 0 && $row['activate'] == 1 && $row['paid'] == 1 && date("Y-m-d H:i:s") > $row['expirydate']) { $company = "pianocourse101@hotmail.com"; $subject = "Level 1 yearly subscriptionplan payment has been cancelled!"; $mailTo = $_SESSION['u_email']; $headers = "From: ".$company; $txt = "Hello ".$_SESSION['u_first']." ".$_SESSION['u_last']."! \n\n Your payment was due on the ".$row['paidbydate'].". Your Level 1 yearly subscriptionplan has been cancelled because you have failed to make payment and already have received an email reminder! \n\nPlease subscribe again if you wish to access your Level 1 videos!"; mail($mailTo, $subject, $txt, $headers); $sql = "UPDATE memberships SET subscriptionplan = ?, subscriptionplandate = ?, feesyearly = ?, paid = ? expirydate = ?, paidbydate = ?, emailreminder = ?, overdue = ?, activate = ? WHERE user_uid = ? "; $stmt = mysqli_stmt_init($conn); //Prepare the prepared statement if (!mysqli_stmt_prepare($stmt, $sql)) { echo 'SQL statement failed'; } else { //Bind parameters to the placeholder mysqli_stmt_bind_param($stmt, "ssiissiiis", $subscriptionplandelete, $subscriptionplandatedelete, $feeyearlysdelete, $paidreset, $expirydatedelete, $paidbydatedelete, $emailreminderreset, $overduereset, $activatereset, $_SESSION['u_uid']); //Run parameters inside database mysqli_stmt_execute($stmt); } header("Location: update.php?level1=expired"); exit(); // last working code! } if ($row['subscriptionplan'] === 'Level 1' && $row['activate'] == 1 && $row['paid'] == 1 && date("Y-m-d H:i:s") <= $row['expirydate']) { header("Location: level1videos.php?levelvideos=success"); exit(); } else { if ($row['subscriptionplan'] === 'Level 1' && $row['activate'] == 1 && $row['paid'] == 0 && date("Y-m-d H:i:s") <= $row['expirydate']) { header("Location: update.php?level1=notpaid"); exit(); } else { if ($row['subscriptionplan2'] === 'Level 2' && $row['level2promo_activate'] == 1 && date("Y-m-d H:i:s") > $row['expirydate2'] && $row['paid2'] == 0 && $row['activate2'] == 0) { header("Location: update.php?level1promo=expired"); exit(); } else { if ($row['subscriptionplan2'] === 'Level 2' && $row['level2promo_activate'] == 1 && date("Y-m-d H:i:s") <= $row['expirydate2'] && $row['paid2'] == 0 && $row['activate2'] == 0) { header("Location: level2videos.php?level1promo=success"); exit(); } else { header("Location: update.php?level1=notchosen"); exit(); } } } } } } } } } } } } }
-
It was my fault... the name is not called submit.. I had the wrong name
-
Hey guys! I am trying to make a forum and got the following errors: According to my url, the error seems to be in my post_reply_parse.php.... Upon further looking at the code, I think the problem lies in this section: ``` <?php include_once 'header.php'; if (!isset($_SESSION['u_uid'])) { header ("Location: index.php?post_reply_parse=notlogin"); exit(); } else { if (!isset($_POST['submit'])) { header("Location: post_reply.php?post_reply_parse=error"); exit(); } else { include_once 'includes/dbh.php'; $date = date("Y-m-d H:i:s"); $creator = $_SESSION['u_uid']; $reply_content = $_POST['reply_content']; $cid = $_POST['cid']; $tid = $_POST['tid']; $limit = 1; ``` For some reason, if I do this, then it works: <?php include_once 'header.php'; if (!isset($_SESSION['u_uid'])) { header ("Location: index.php?post_reply_parse=notlogin"); exit(); } else { include_once 'includes/dbh.php'; $date = date("Y-m-d H:i:s"); $creator = $_SESSION['u_uid']; $reply_content = $_POST['reply_content']; $cid = $_POST['cid']; $tid = $_POST['tid']; $limit = 1;
-
What is the correct way to do multiple isset statement?
piano0011 replied to piano0011's topic in PHP Coding Help
I understand, I was trying to get it to work first before substituting it with the ? -
What is the correct way to do multiple isset statement?
piano0011 replied to piano0011's topic in PHP Coding Help
I have listened and in my other forum, I did mention that my database is working. I know that we all have our own unique ways to set up variables but I do understand how to get it to work with my database. I am not copying and pasting but am a visual learning and therefore learns thing when other people are showing contents, such as on the youtube videos. I just find it easier to learn that way. I have also read some stuff from stackoverflow but they mentioned that isset is mainly used to see if a variable is set such as in a form? I should use session to determine if a session exists or not? Besides, I have no prior computer skills so I need to find ways to learn from scratch and tried to make effort to learn.. -
What is the correct way to do multiple isset statement?
piano0011 replied to piano0011's topic in PHP Coding Help
I just saw your comment just then... maybe I should change the || to &&.. That is weird.... I changed it to && and it does work but just wondering how come it is working in the tutorial? My apologies, he made a mistake in the video.. he forgot to check to see if it is an empty string -
What is the correct way to do multiple isset statement?
piano0011 replied to piano0011's topic in PHP Coding Help
Okay... because I am trying to follow this tutorial on how to set up a forum but I am stucked at around the 13:23 mins mark. When I tested the page at the end of that video segment, it is always saying that I am not logged in even though that I am.. I will attach the two latest files, which I think should be working hand in hand below. It should take me to the create_topic.php page. It seems that the $_GET variable is not picking up the cid <?php include_once 'header.php'; if (!isset($_SESSION['u_uid'])) { header("Location: index.php?view_category=notlogin"); exit(); } else { include_once 'includes/dbh.php'; $cid = $_GET['cid']; $logged = " <a href='create_topic.php?cid=".$cid."'>Click here to create a topic</a>"; $sql = "SELECT id FROM categories WHERE id= '".$cid."' LIMIT 1"; $stmt = mysqli_stmt_init($conn); if (!mysqli_stmt_prepare($stmt, $sql)) { echo 'SQL error'; } else { mysqli_stmt_execute($stmt); $result = mysqli_stmt_get_result($stmt); $resultCheck = mysqli_num_rows($result); if ($resultCheck >0) { $sql2 = "SELECT * FROM topics WHERE category_id='".$cid."' ORDER BY topic_reply_date DESC"; $stmt = mysqli_stmt_init($conn); if (!mysqli_stmt_prepare($stmt, $sql2)) { echo 'SQL error'; } else { mysqli_stmt_execute($stmt); $result2 = mysqli_stmt_get_result($stmt); $resultCheck2 = mysqli_num_rows($result2); if ($resultCheck2 > 0) { $topics .= "<table width='100%' style='border-collapse: collapse:'>"; $topics .= "<tr><td colspan='3'><a href='forum.php'>Return to Forum Index</a>".$logged."</td></tr>"; $topics .= "<tr style='background-color: #dddddd:'><td>Topic Title</td>><td width='65' align='center'>Replies</td><td width='65' align='center'>Views</td></tr>"; $topics .= "<tr><td colspan='3'><hr></td></tr>"; while ($row = mysqli_fetch_assoc($result2)) { $tid = $row['id']; $title = $row['topic_title']; $views = $row['topic_views']; $date = $row['topic_date']; $creator = $row['topic_creator']; $topics .= "<tr><td><a href='view_topic.php?cid=".$cid."&tid=".$tid."'>".$title."</a><br /><span class='post_info'>Posted by: ".$creator." on ".$date."</span></td><td align='center'>0</td><td align='center'>".$views."</td></tr>"; $topics .= "<tr><td colspan='3'><hr /></td></tr>"; } $topics .= "</table>"; } else { echo "<a href='header.php'>Return to the Forum page</a>"; echo "<p> There are no topics in this Category yet.".$logged."</p>"; } } }else { echo "<a href='header.php'>Return to the Forum page</a>"; echo "<p> You are trying to view a catebory that does not exists yet.</p>"; } } } // This is the second file called create_topic.php <?php include_once 'header.php'; if ((!isset($_SESSION['u_uid'])) || ($_GET['cid'])) { header("Location: index.php?create_topic=notlogin"); exit(); } $cid = $_GET['cid']; ?> <!DOCTYPE html> <html> <head> <title></title> </head> <body> <form action="create_topic_parse.php" method="POST"> <label>Topic Title</label> <br></br> <input type="text" name="topic_title" size="98" maxlength="150"> <br></br> <label>Topic Content</label> <br></br> <textarea name="topic_content" rows="5" cols="75"></textarea> <br></br> <br></br> <input type="hidden" name="cid" value="<?php echo $cid; ?>"> <input type="submit" name="topic_submit" value="Create Your Topic"> </form> </body> </html> -
Hey guys! I have seen on the internet a couple of ways to write the following statement but the latter one looks a bit weird with that extra opening ( before !isset, which way is the norm here? if (isset($_POST['room']) || ($_POST['cottage']) || ($_POST['villa'])) { } but I have seen somewhere that you can also write if ((!isset($_POST['submit'])) || ($_GET['u_uid']))
-
I can get my php form to process the timer result and insert the record into the database but when I add the header function, it keeps taking me to the header function instead of showing the timer. My guess is that because it is processing the php first, it is doing this. I just like to know if I can have a header function it this is the case? <?php include_once 'includes/dbh.php'; $timer = 60; $time = $_POST['time']; $user_uid = 'piano0011'; $sql = "UPDATE primerlevel_tests SET time_achieved = ? WHERE user_uid = ? "; $stmt = mysqli_stmt_init($conn); if (!mysqli_stmt_prepare($stmt, $sql)) { echo 'SQL error'; } else { mysqli_stmt_bind_param($stmt, "ss", $time, $user_uid); mysqli_stmt_execute($stmt); } header("Location: update.php?countdown=success"); exit(); ?> <style type="text/css"> div.timer { text-align: center; margin: 15% auto; } #msg { color: red; } </style> <html> <head> <script type="text/javascript"> var timer = <?php echo $timer ?>; // 1 minute timer.... var min = 0; var sec = 0; var active = 1; function startTimer() { if (active==0) return; if (timer == 0) timer = <?=$timer?> ; timer--; min = parseInt(timer/60); sec = parseInt(timer%60); if(timer < 1) { $timer = 0; min = 0; sec = 0; document.getElementById("msg").innerHTML = "You have to start again" ; document.getElementById("time").value = "00:00:00"; active = 1; return; } else { if (min < 10) min = '0'+min; if (sec < 10) sec = '0'+sec; document.getElementById("msg").innerHTML = "" ; document.getElementById("time").value = "00:" + min.toString() + ":" + sec.toString(); } setTimeout(function() { startTimer(); }, 1000); } function stop() { if (min + sec > 0) { alert("Thank you for completing the test. You finished the test at: " + min.toString() + ":" + sec.toString()); document.form1.submit(); active = 0; } } </script> </head> <body> <div class="timer"> <h1>Welcome to Timertrone.</h1> <br> <form name='form1' action='' method="post"> Time left: <input type="text" name="time" id="time" value=""> </form> <span id="msg"></span> </br> <button name="start" onclick="startTimer()">Start</button> <button name="stop" onclick="stop()">Stop</button> </div> </body> </html> It only works if I get rid of the // header("Location": update.php?countdown=success");