Hi,
Im having trouble reading to my database. I created a simple survey. 3 of my questions connect to my database no problem. However im having problems reading my "are you aware of how courses are currenltly introduced" question. For some reason when i submit the questions, my awareness question is not submitted. Hope someone can help. Here is the code:
survey.php
<!--
.style1 {
font-family: "Times New Roman", Times, serif;
font-weight: bold;
font-size: 18px;
}
.style11 {font-size: 16px}
-->
</style>
</head>
<body>
<link href="styles.css" rel="stylesheet" type="text/css">
<div align="center">
<p class="style1"><img src="images/nci5.gif" width="140" height="121"></p>
<p class="style1">Please answer all questions as honestly as possible! </p>
</div>
<form action="surveyconnect.php" method="post">
<div align="center">
<table border="1">
<tr>
<td><div align="left" class="style11">What gender are you?</div></td>
<td colspan="5"><div align="left" class="style11">
<input type="radio" name="gender" value="1">
Male |
<input type="radio" name="gender" value="2">
Female</div></td>
</tr>
<tr>
<td><div align="left" class="style11">What is your relationship with the college?</div></td>
<td colspan="5"><div align="left" class="style11">
<input type="radio" name="relationship" value="1">
Lecturer |
<input type="radio" name="relationship" value="2">
Marketing</div></td>
</tr>
<tr>
<td><div align="left" class="style11">Are you aware of how courses are currently introduced?</div></td>
<td colspan="5"><div align="left" class="style11">
<input type="radio" name="awareness" value="1">
Yes |
<input type="radio" name="awareness" value="2">
No</div></td>
</tr>
<td><div align="left" class="style11">How satisfied are you in relation to how courses are currently introduced? (1=not very, 4=very) </div></td>
<td><div align="left" class="style11">
<input type="radio" name="satisfaction" value="1" />
1</div></td>
<td><div align="left" class="style11">
<input type="radio" name="satisfaction" value="2" />
2</div></td>
<td><div align="left" class="style11">
<input type="radio" name="satisfaction" value="3" />
3</div></td>
<td><div align="left" class="style11">
<input type="radio" name="satisfaction" value="4" />
4</div></td>
</tr>
</table>
<br />
<input type="submit" value="Submit" name="Submit" />
<input name="reset" type="reset" value="Reset" />
<br>
<br>
</div>
</form>
</body>
</html>
surveyconnect.php
<?PHP
require "db_survey.php";
$link = mysql_connect( $db_host, $db_username, $db_password ); // connection to database
if ( !$link )
exit ( "Database error: " . mysql_error() );
mysql_select_db ( $db_name, $link ); // selects database name
$gender = $_POST ['gender'];
$relationship = $_POST ['relationship'];
$awareness = $_POST ['awareness'];
$satisfaction = $_POST ['satisfaction'];
$result = mysql_query( "INSERT INTO onlinesurvey (gender, relationship,awareness, satisfaction) VALUES('$gender', '$relationship','$awareness', '$satisfaction')", $link ); // insert post into db
if( !$result )
exit ( "Query failed: " . mysql_error() );
?>
<html>
<head>
<title>Results</title>
<style type="text/css">
<!--
.style1 {
font-size: 24px;
font-weight: bold;
}
-->
</style>
</head>
<body>
<div align="center" class="style1">
<p> </p>
<p> </p>
<p>Thank you for taking the time to complete the survey.</p>
<p> </p>
<p>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="103" height="24">
<param name="movie" value="button1.swf">
<param name="quality" value="high">
<embed src="button1.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="103" height="24" ></embed>
</object>
</p>
</div>
</body>
</html>