السلام عليكم و رحمة الله و بركاته على على وجه تجرج و لكن صادفت مشكلة لا و هي انني اصمم برنامج لاداره الفنادق و يجب ان يوجد صفحة لكي يتم اضافه المستخدمين للنظام و لكن انا لست قادر على اضافه المستخدمين ارجو التكرم باعطائي الحل سوف ارفق لكم الكود فله من مساعد لي في حل المشكلة
ob_start();
session_start();
include("../connection/admin_connect.php");
?>
<HTML>
<HEAD>
<TITLE>User Entry Form</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<link href="../css/style.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 MARGINWIDTH=0>
<script language="javascript" type="text/javascript">
function validate()
{
docf=document.user_entry_form;
if(document.getElementById)
{
document.getElementById('lbl_sel_role').style.color="#000000";
document.getElementById('lbl_txtusername').style.color="#000000";
document.getElementById('lbl_txtpass').style.color="#000000";
}
if(docf.sel_role.value==0)
{
alert("Select Role.");
document.getElementById('lbl_sel_role').style.color="#FF0000";
return false;
}
if(docf.txtusername.value==0)
{
alert("Enter username.");
document.getElementById('lbl_txtusername').style.color="#FF0000";
docf.txtusername.focus();
return false;
}
if(docf.txtpass.value==0)
{
alert("Enter Passward.");
document.getElementById('lbl_txtpass').style.color="#FF0000";
docf.txtpass.focus();
return false;
}
//return true;
}
</script>
<?
if($submit==1)
{
if($txtusername!=" ")
{
$record_exists=mysql_query("select * from tbl_user_info where username='".$txtusername."'");
$n=mysql_num_rows($record_exists);
if($n==0)
{
//code for genrating the serial number for the table
$result = mysql_query("select max(user_id) from tbl_user_info ");
$row = mysql_fetch_array($result);
if($row[0]==1)
{ $id=2; }
else
{ $id=$row[2]+1; }
//end of the serial code genration
// echo("insert into tbl_user_info values('$id','$sel_role','$txtusername','$txtpass')");
mysql_query("insert into tbl_user_info values('$id','$sel_role','$txtusername','$txtpass')");
//echo ("insert into tbl_dept values('$id','$txtdept_nm')");
$msg="User Inserted";
}
else
{
$msg="This User already exists.";
}
}
else
{
$msg="Enter Username.";
}
}
?>
<div align="center">
<TABLE WIDTH=723 BORDER=0 CELLPADDING=0 CELLSPACING=0>
<TR>
<TD COLSPAN=3> <IMG SRC="../images/common_01.gif" WIDTH=723 HEIGHT=35 ALT=""></TD>
</TR>
<TR align="center">
<TD WIDTH=723 HEIGHT=31 COLSPAN=3 background="../images/common_02.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="5"></td>
</tr>
<tr>
<td height="15" align="center"><? include("include/main_links_admin.php");?></td>
</tr>
<tr>
<td height="5"></td>
</tr>
</table></TD>
</TR>
<TR>
<TD background="../images/common_03.gif" WIDTH=11 HEIGHT=602> </TD>
<TD WIDTH=700 HEIGHT=602 align="center" valign="top" bgcolor="#EFEEEE">
<form name="user_entry_form" action="user_entry_form.php?submit=1" method="post">
<table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr><td colspan="2" align="center" valign="top"><img src="../images/Header.jpg"></td></tr>
<tr><td colspan="2" height="10"></td></tr>
<tr>
<td height="44" align="center">
<? if($msg!="")
{
?>
<table width="80%" border="0" cellpadding="0" cellspacing="0" class="Table_Border_black">
<tr>
<td width="2%"> </td>
<td width="98%" align="center" class="error_font_red"><? echo $msg; ?></td>
</tr>
</table>
<? } ?>
</td>
</tr>
<tr>
<td align="center">
<table width="85%" border="0" cellpadding="0" cellspacing="0" class="Table_Border_black">
<tr>
<td height="25"> </td>
<td colspan="3" class="Column_Head_black">User Info </td>
</tr>
<tr>
<td height="25"> </td>
<td class="site_font_black"><span id="lbl_sel_role">Role : </span></td>
<td colspan="2">
<?
$type_sel=mysql_query("select * from tbl_user_role");
?>
<select name="sel_role" class="text_box_button" onChange="document.room_type_view.submit();">
<option value="0">Select Role</option>
<?
while($type_rec=mysql_fetch_array($type_sel))
{
?>
<option value="<? echo $type_rec['role_id']; ?>" <? if($sel_role==$type_rec["role_id"]){ echo "selected";};?>><? echo $type_rec["user_role"];?></option>
<? }?>
<option value="0">---------------------------------</option>
</select>
</td>
</tr>
<tr>
<td height="25"> </td>
<td class="site_font_black"><span id="lbl_txtusername">Username : </span></td>
<td colspan="2"><input name="txtusername" type="text" class="text_box_button" size="35"></td>
</tr>
<tr>
<td width="3%" height="25"> </td>
<td width="34%" class="site_font_black"><span id="lbl_txtpass">Password : </span></td>
<td colspan="2"><input name="txtpass" type="password" class="text_box_button" size="35"></td>
</tr>
<tr>
<td height="19"> </td>
<td> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td height="30"> </td>
<td> </td>
<td width="21%"><input type="image" name="submit" value="1" src="button_images/bt_save.jpg" width="48" height="22" border="0" onClick="return validate();"> </td>
<td width="42%"><a href="admin_view.php"> <img src="button_images/bt_exit.jpg" width="48" height="22" border="0"> </a></td>
</tr>
</table></td>
</tr>
</table>
</form>
</TD>
<TD background="../images/common_05.gif" WIDTH=12 HEIGHT=602> </TD>
</TR>
<TR>
<TD COLSPAN=3 background="../images/common_06.gif" WIDTH=723 HEIGHT=42><? include("../footer.php");?> </TD>
</TR>
</TABLE>
</div>
</BODY>
</HTML>
<? ob_end_flush(); ?>و شكرا