PHP code help

Status
Not open for further replies.

WHWebSolutions

In Runtime
Messages
128
Hello all well I had a friend make some code for me and it works just like I want it to but I have 1 problem. The page looks just how I want it to in IE (questions are above and below each other) but in Firefox the questions are side by side. Can someone help me out? Below is the code. Please help me.

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Version 2</title>
</head>
<body>

<form action="test.php" method="post">

<?php 
	$questionCounter = 0;
	$resultCounter = 0;
	testFor('Question 1?','1',$questionCounter,$resultCounter);
	testFor('Question 2?','2',$questionCounter,$resultCounter);
	testFor('Question 3?','3',$questionCounter,$resultCounter);
	testFor('Question 4?','4',$questionCounter,$resultCounter);
	getResult('Your cat is','mau',$questionCounter,$resultCounter);
?>

<input type="submit" value="Test">

</form>

</body>
</html>

<?php
 function testFor($question,$key,&$qc,&$rc) {
	 if (isset($_POST[$key])) {
		 $qc++;
		 $i=(int)$_POST[$key];
		 if ($i < 0) {$i=0;};
		 if ($i > 100) {$i=100;};
		 $rc=$rc+$i;
	 }
	 else {
		 createList($question,$key);
	 }

 }

 function createList($text,$name) {
	 echo htmlentities($text) . '' .
	 	'<select name="' . $name . '" size="1">' .
		//Yes, A little bit, Rather not, No, Not at all 
	 	'<option value="100">Yes</option>' .
	 	'<option value="80">A little bit</option>' .
	 	'<option value="50" selected="selected">Rather not</option>' .
		'<option value="20"> No</option>' .
	 	'<option value="0">Not at all</option>' .
		'</select></br>' . "\n";
 }

 function getResult($text,$property,$qc,$rc) {
	 if ($qc>0) {
		 $i=$rc/$qc;
		 echo htmlentities($text) . ' ' . $i . '% ' . htmlentities($property) . ' and ' . (100-(double)$i) . '% not ' .
		 htmlentities($property) . '.</br>' . "\n";
	 }
 }
?>
 
Status
Not open for further replies.
Back
Top Bottom