Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

I don't know why my checkbox isn't working.

$
0
0

Hey guys,

 

I'm struggling to find why my checkbox isn't posting as set. I would really appreciate it if someone could tell me what I'm doing wrong.

 

Here's the form:

	$form = "<form action='./register.php' method='post'>
	<table>
	<tr>
		<td></td>
		<td><font color='red'>$errormsg</font></td>
	</tr>
	<tr>
		<td>Username:</td>
		<td><input type='text' name='user' value='$getuser' /></td>
	</tr>
	<tr>
		<td>Email:</td>
		<td><input type='text' name='email' value='$getemail' /></td>
	</tr>
	<tr>
		<td>Password:</td>
		<td><input type='password' name='pass' value='' /></td>
	</tr>
	<tr>
		<td>Retype Password:</td>
		<td><input type='password' name='retypepass' value='' /></td>
	</tr>
	<tr>
		<td>Receive Forum Notifications:</td>
		<td><input type='checkbox' name='fn' value='1' /></td>
	</tr>
	<tr>
		<td></td>
		<td><input type='submit' name='registerbtn' value='Register' /></td>
	</tr>
	</table>
	</form>";

And here's the beginning of the page:

<?php
error_reporting(E_ALL ^ E_NOTICE);
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
	<head>
		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
		<title>Member System - Register</title>
		<link href="./style.css" rel="stylesheet" type="text/css" />
	</head>
<body>
<?php

	if ( $_POST['registerbtn'] ) {
		$getuser = $_POST['user'];
		$getemail = $_POST['email'];
		$getpass = $_POST['pass'];
		$getretypepass = $_POST['retypepass'];
		if (isset($_POST['fn'])) {
			echo "checked";
			exit();
		}
		else
			echo "unchecked";
			exit();

Thanks so much!!


Viewing all articles
Browse latest Browse all 13200

Trending Articles