Ch 11 creating a user reg script
Hi all,:)
Hope someone will reply!!
I am having problem with this code,please help me-
[code]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<?php
//register.php
include_once "./common_db.inc";
function in_use($userid)
{
global $user_tablename;
$query="SELECT userid FROM $user_tablename WHERE userid='$userid'";
$result=mysql_query($query);
if(!mysql_num_rows($result)){
return 0;
}else{
return 1;
}
}
function register_form()
{
global $userposition;
global $PHP_SELF;
$link_id=db_connect();
$link_id=db_connect();
mysql_select_db("sample_db");
$position_array=enum_options('userposition',$link_ id);
mysql_close($link_id);
?>
<center><h3>Create your account!</h3></center>
<form method="post" action="<?php echo $PHP_SELF ?>">
<input type="hidden" name="action">
<div align="center"><center><table border="1" width="90%">
<tr>
<th width="30%" nowrap>Desired ID</th>
<td width="70%"><input type="text" name="userid" size=8"></td>
</tr>
<tr>
<th width="30%" nowrap>Desired Password</th>
<td WIDTH="70%"><input type="password" name="userpassword2" size="15"></td>
</tr>
<tr>
<th width="30%" nowrap>Full Name</th>
<td width="70%"><input type="text" name="username" size="20"></td>
</tr>
<tr>
<td width="30%" nowrap>Position</th>
<td width="70%"><select name="userposition" size="1">
<?php
?>
for($i=0;$i<count($position_array);$i++){
if(!isset($userposition) && $i==0){
echo "<OPTION SELECTED VALUE=\"".$position_array[$i]."\">".$position_array[$i]."</OPTION>\n";
}else if($userposition==$cposition_array[$i]){
echo "<OPTION SELECTED VALUE=\"".$position_array[$i]."\">".
$position_array[$i]."</td>OPTION>\n";
}
}
?>
</select></td>
</tr>
<tr>
<th width="30%" nowrap>Email</th>th>
<td width="70%"><input type="text" name="useremail" size="20"
</td>
</tr>
<tr>
<th width="30%" nowrap>Profile</th>th>
<td WIDTH="70%"><textarea rows="5" cols="40" name="userprofile">
|