Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Testing your Oscar Award Trivia

ID: 3529585 • Letter: T

Question

Please look over my code its a game where you guess the tittle of a movie and the letters that remain are presented on the screen as astricks. I don mt have MySQL installed so please test it if you can and tell me what wrong and some pointers on how to fix it. < head> < title>Guessing Game < /head> < body> < h1>Guessing Game <?php echo " "; $ages['War Horse']; $ages['8 Mile']; $rand_keys = array_rand($ages, 1); $guesses = 3; < form action="Week5.php" method="get" enctype="application/x-www-form-urlencoded"> < p> < input type="hidden" name="progress" < ?php if (isset($Progress)) echo "value='$Progress'"; else echo "value='**********'"; ?> />< p> < /form> <?php $movie = isset($_POST['movie']) ? $_POST['movie'] : false; } @$_SESSION[$movie]['$guesses']++; if ($realyear && $_SESSION[$movie]['$guesses'] < 3) { ?> < /body> < /html>

Explanation / Answer

Its not clear what you want to do.

If you enter a movie name what will happen? whether it will search the database for the name?

What will happen after submit is pressed?

--------------------------------------

However if you want to show whether the movie is in the databse or not?

You can do the following..

In the file which u have written. Ask the user to enter a movie name.

After submitting this will go to week5.php

In week5.php ,take the movie name in a variable like...

$movie=$_POST["movie_name"];

now you can search the database whether this movie exists or not.

finally you return back to first page saying correct or incorrect.