Search the Community
Showing results for tags 'intro programming'.
-
Hey everyone im new to the forum, Okay so I need some help and maybe snippets on helping me achieve creating a program. The goal of this is to create a game which has the user guess which U.S. President corresponds to a randomly chosen term in office. A term (in office) constitutes a time range in which the U.S. President was the same. It turns out that the range of years of the term corresponds to a single President, but not vice-versa, because there is one U.S. President who had two terms. Generate the random term with this statement: $term = $terms[ mt_rand( 0, count($terms)-1 ) ]; so this is what i have. NOTE: THE OTHER PROGRAM'S PHP FILES ARE MADE. <?php require_once "include/Session.php"; $session = new Session(); if (!isset($session->valid)) { require_once "login.php"; exit(); } require_once "include/presidents.php"; // this is the list of the terms $terms = array_keys($term_presidents); // this is the list of all names (duplicates removed), sorted by last name $presidents = array_unique(array_values($term_presidents)); usort($presidents, "byLastName"); /* DO NOT MODIFY THE ABOVE LINES !!!!! */ $params = (object) $_REQUEST; print_r($params); /* Remaining Php handler code goes here */ ?> <!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" /> <meta http-equiv="X-UA-Compatible" content="IE=edge"/> <title>Average Calculator</title> <style type="text/css"> body { padding: 20px; } #logout { position: absolute; top: 40px; right: 40px; } /* Add more style rules */ </style> </head> <body> <a id="logout" href="logout.php">Log out</a> <h2>President Guess Game</h2> <form action="program.php" method="get"> <button type="submit" name="reset" >New Game</button> </form> <!-- Add form and presentation code --> </body> </html>
- 8 replies
-
- php
- intro programming
-
(and 1 more)
Tagged with: