I just added ob_start(); and I get the same error
To use superglobals are you saying to replace $id with $_POST['id'] ? if so does it apply for all of them $name $_POST['name'] ect.. ?
Heres what the php now looks like:
PHP Code:
<?php
ob_start();
if (isset($_POST['submit'])) {
if (!get_magic_quotes_gpc()) {
$id = addslashes($id);
$name = addslashes($name);
$email = addslashes($email);
$course = addslashes($course);
$question = addslashes($question);
}
$dbh=mysql_connect ("localhost", "username", "password");
mysql_select_db ("username");
$sql = "INSERT INTO unrealtournament VALUES ('$id','$name','$email','$course','$question')";
$result = mysql_query($sql) or print("Can't insert into table emaillist.<br />" . $sql . "<br />" . mysql_error());
if ($result != false) {
header('Location: http://www.jamesgardner.lincoln.ac.uk/unrealtournament/results.php');
exit;
}
mysql_close();
}
?>
<div id="main">
Its time to get it on..
</div>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<table align="center" border="1" cellspacing="0" cellpadding="3">
<tr><td>Username:</td><td>
<input type="text" name="name" maxlength="40">
</td></tr>
<tr>
<td>E-Mail:</td>
<td>
<input type="text" name="email" maxlength="100">
</td></tr>
<tr>
<td>Course:</td>
<td>
<input type="text" name="course" maxlength="150">
</td></tr>
<tr>
<td>Would you like: </td>
<td>
<select name="question">
<option value="Death Match" selected="selected">Death Match</option>
<option value="Capture the Flag">Capture the Flag</option>
<option value="Both">Both</option>
</select>
</td></tr>
<tr><td colspan="2" align="right">
<input type="submit" name="submit" value="Sign Up">
</td></tr>
</table>
</form><br />
</div>
</body>
</html>
<?php
ob_end_flush();
?>
Bookmarks