Jump to content

[SOLVED] Register Page problem


jaybeeb

Recommended Posts

Only the username and password are logged into the table, nothing else?

 

    <?php

include 'library/config.php';
include 'library/opendb.php';

?>
<form method="POST" action="register.php">
<table border="0" style="font-size: 15px; font-family: Tahoma; border: 1px">
<tr>
	 <td>
			Username:
	</td>
	<td>
			<input type="text" name="username" value="<?php echo $_POST['username']; ?>" />
	</td>
</tr>

<tr>
	<td>
			Password:
	</td>

	<td>
			<input type="password" name="password" value="<?php echo $_POST['password']; ?>" />
	</td>
</tr>
<tr>
	<td>
			Address:
	</td>

	<td>
			<input type="text" name="text" value="<?php echo $_POST['address']; ?>" />
	</td>
</tr>
<tr>
	<td>
			Phone:
	</td>

	<td>
			<input type="integer" name="text" value="<?php echo $_POST['telephone']; ?>" />
	</td>
</tr>
<tr>
	<td>
			Email:
	</td>

	<td>
			<input type="text" name="text" value="<?php echo $_POST['email']; ?>" />
	</td>
</tr>
<tr>
	<td>
			Type:
	</td>

	<td>
			<select input type="text" name="text" value="<?php echo $_POST['type']; ?>" />
			<option>Applicant</option>
			<option>Employer</option>
			</select>
	</td>
</tr>
<tr>
	<td colspan="2" align="center">	<input type="submit" name="submit" value="Register"/>
	</td>
</tr>
</table>
</form>

<?php

if($_POST['submit']) {

$username = $_POST['username'];
$password = $_POST['password'];
$address = $_POST['address'];
$telephone = $_POST['telephone'];
$email = $_POST['email'];
$type = $_POST['type'];

$curnum = 0;


if(!$username)	{
	$curnum ++;
	echo "<font color='black'>" . $curnum . ". You must enter a username.</font><Br>\n";
}

if(!$password)	{
	$curnum ++;
	echo "<font color='black'>". $curnum . ". You must enter a password.</font><Br>\n";
}
if(!$address)	{
	$curnum ++;
	echo "<font color='black'>". $curnum . ". You must enter a address.</font><Br>\n";
}
if(!$telephone)	{
	$curnum ++;
	echo "<font color='black'>". $curnum . ". You must enter a telephone.</font><Br>\n";
}
if(!$email)	{
	$curnum ++;
	echo "<font color='black'>". $curnum . ". You must enter a email.</font><Br>\n";
}



$sql = "SELECT * FROM user WHERE username='".$username."'";
$res = mysql_query($sql) or die(mysql_error());

if(mysql_num_rows($res) > 0)	{
	$curnum ++;
	echo "<font color='black'>".$curnum . ". The username '".$username."' already exists</font>\n";
}

if($curnum == 0)	{
	mysql_query("INSERT INTO user VALUES (`id`,'". $username ."', '".$password."','". $address ."','". $telephone ."','". $email ."','". $type ."')") or die(mysql_error());
 echo "<font color ='#B22222'> <H3>You have succesfuly registered as '<b>".$username."</b>'</H3></font>\n";
 echo "<a href='login3.php'><H3>Login Now</H3></a>";


}
}


?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.