Display image in PHP quiz results

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
natalia
Forum Newbie
Posts: 6
Joined: Sat Mar 06, 2010 5:11 am

Display image in PHP quiz results

Post by natalia »

Hi,

I have a multiple choice quiz made up of a number of files:
- quiz.html - all the questions
- quiz.qz - the file containing all the php code (including the results)
- quizresults.php - the file that calculates & shows the results
- styles.css

I'm having trouble showing an image in the results. The code is as follows:

Code: Select all

echo '<head>';
echo ' <link rel="stylesheet" href="styles.css" type="text/css">';
echo '</head>';

$title="Quiz: ---";
$types="5";
$questions="16";

$type[0] = "<p>If you answer mostly As...</p>";
$type[1] = "<p>If you answer mostly Bs...</p>";
$type[2] = "<p>If you answer mostly Cs...</p>";
I was wondering how I could embed a .jpg after each $type so that an image appears before the description in the results...

Thank you
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: Display image in PHP quiz results

Post by social_experiment »

Code: Select all

$type[2] = "<p>If you answer mostly Cs <img src=\"path/to/file\" />...</p>";
Are you think of something like this?
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Post Reply