<!DOCTYPE HTML>
<html>
<head>
<title>Radioactivity Questionnaire</title>
<style>
body {font: 13px Arial,Tahoma,Calibri,Verdana,Geneva,sans-serif;}
.textfield{ background: white; border: 1px double #DDD; border-radius: 5px; box-shadow: 0 0 2px #333; color: #666; padding: 5px 10px; width: 600px; outline: no font: 13px Arial,Tahoma,Calibri,Verdana,Geneva,sans-serif}
.textfieldsmall{ background: white; border: 1px double #DDD; border-radius: 5px; box-shadow: 0 0 2px #333; color: #666; padding: 5px 10px; width: 100px; outline: no font: 13px Arial,Tahoma,Calibri,Verdana,Geneva,sans-serif}
</style>
</head>
<? if (!isset($_POST['submit'])) { ?>
<body>
<form name="myform" action="index.php" method="post">
<h2> Radioactivity Questionnaire </h2>
<!--AGE-->
<p><strong>Are you male or female?</strong></p>
<input type="radio" name="sex" value="Male" checked> Male <br />
<input type="radio" name="sex" value="Female"> Female <br />
<!---->
<hr />
<!--TYPES OF RADIATION-->
<p><strong>What types of radioactive sources have you heard of? Please list them below, each on a new line</strong></p>
<textarea title="sourceOfRadiation" class="textfield" id="radiationSources" name="radiationSources" rows="4"></textarea><br /><br />
<!---->
<hr />
<!--WHY ARE THEY DANGEROUS?-->
<p><strong>From your knowledge, why are radioactive sources dangerous to living creatures?</strong></p>
<textarea title="dangersOfRadiation" class="textfield" id="dangers" name="dangers" rows="3"></textarea><br /><br />
<!---->
<hr />
<!--WAYS TO PREVENT-->
<p><strong>Give some methods that you could use to reduce or prevent harm from radioactive sources</strong></p>
<textarea title="preventionOfRadiation" class="textfield" id="prevention" name="prevention" rows="3"></textarea><br /><br />
<!---->
<hr />
<!--WHO WOULD YOU GO TO FOR ADVICE?-->
<p><strong>Who, or where, would you go to for advice about radiation? List some examples below, each on a new line</strong></p>
<textarea title="sourceForAdvice" class="textfield" id="advice" name="advice" rows="4"></textarea><br /><br />
<!---->
<hr />
<!--DO YOU UNDERSTAND BACKGROUND RADIATION?-->
<p><strong>Do you understand what is meant by the term "Background Radiation"?</strong></p>
<input type="radio" name="backgroundRad" id="backgroundRad_yes" value="Yes"> Yes <br />
<input type="radio" name="backgroundRad" id="backgroundRad_no" value="No" checked> No <br />
<!---->
<hr />
<!--DO YOU UNDERSTAND BACKGROUND RADIATION?-->
<p><strong>If yes, give a simple definition below</strong></p>
<textarea title="backgroundRadDefinition" class="textfield" id="definition" name="definition" rows="3"></textarea><br /><br />
<input type="submit" name="submit" value="Submit"/>
</form>
</body>
</html>
<?
}
else{
$db = mysql_connect("localhost","USERNAME",'PASSWORD');
if(!$db) die("Error connecting to MySQL database.");
function PrepSQL($value) {
if(get_magic_quotes_gpc()) {
$value = stripslashes($value);
}
$value = "'" . mysql_real_escape_string($value) . "'";
return($value);
}
$sex = PrepSQL($_POST['sex']);
$radSource = PrepSQL($_POST['radiationSources']);
$dangers = PrepSQL($_POST['dangers']);
$prevention = PrepSQL($_POST['prevention']);
$advice = PrepSQL($_POST['advice']);
$backgroundRadRadio = PrepSQL($_POST['backgroundRad']);
$backgroundRadDefinition = PrepSQL($_POST['definition']);
$ip=$_SERVER['REMOTE_ADDR'];
$sql = "INSERT INTO bsodforu_physics_questionnaire.results (Sex, Sources, WhyDangerous, Prevent, Advice, BackgroundDoYouKnow, BackgroundDefinition, IP) VALUES ($sex, '$radSource', '$dangers', '$prevention', '$advice', '$backgroundRadRadio', '$backgroundRadDefinition', '$ip')";
mysql_query($sql);
}
/****************************/
/******** EMAIL CODE ********/
/****************************//*$to = "TO EMAIL";
$subject = "Questionnaire Submitted";
$message = "Questionnaire Submitted";
//$message .= '<h1 style = "font: 22px Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif; font-weight:bold; color:#000080;"> New questionnaire submission</h1>';
//$message .= "A user with the following IP has submitted your questionnaire - <strong><a href=geoip.flagfox.net/?ip=" . $ip . ">" . $ip . '</a></strong><br /><br />';
//$message .= "The results have been logged in the database";
//$message .= '</body></html>';
$from = FROM EMAIL;
//$from_name = "Physics Questionnaire";
//$headers = "From: " . $from_name . "<" . $from . ">" . "\r\n";
//$headers .= "MIME-Version: 1.0\r\n";
//$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
if (mail($to, $subject, $message)) {
echo "Form Sent Successfully - thank you for your feedback";
}}*/
?>