css-man
چهارشنبه 27 مهر 1390, 17:47 عصر
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style2 {color: #FF9900; }
-->
</style>
</head>
<body>
<form method="POST" action="register.php">
<table width="293" border="1">
<tr>
<td width="88" bgcolor="#333333"><div align="center" class="style2">username</div></td>
<td width="189" bgcolor="#333333"><label>
<input name="user" type="text" id="user" />
</label></td>
</tr>
<tr>
<td height="41" bgcolor="#333333"><div align="center" class="style2">password</div></td>
<td bgcolor="#333333"><label>
<input name="pass" type="password" id="pass" />
</label></td>
</tr>
<td height="43" bgcolor="#333333"><div align="center" class="style2">Email</div></td>
<td bgcolor="#333333"><label>
<input name="email" type="text" id="email" maxlength="70" />
</label></td>
<tr>
<td height="47" colspan="2" bgcolor="#99FF00"><label>
<div align="center">
<input type="submit" name="Submit" value="Submit" />
</div>
</label></td>
</tr>
</table>
</form>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<?php
//retrieve form variable
$user = $_POST['user'];
$pass = $_POST['pass'];
$email=$_POST['email'];
if(strlen($user) == 0 || strlen($pass) == 0 )
{
echo "lotfan forme sabtenam ra kamel por konid!";
exit;
}
// connect to db
$db = mysql_connect("localhost","root","");
if(!$db)
{
echo "can not connect to db";
exit;
}
mysql_select_db('usertest');
$query = " insert into admin
(user,pass,email)values
('".$user."','".$pass."','".$email."')";
$result = mysql_query($query);
if($result)
echo mysql_affected_rows().'<b> registred is success fully</br>';
mysql_close($db);
?>
</body>
</html>
اول وقتی فقط نام کاربری و پسورد بود ایراد نمیگرفت ولی وقتی ایمیل رو هم اضافه کردم این ارور رو میده
Notice: Undefined index: email in C:\wamp\www\regi\user\register.php on line 13
میگه ایمیل تعریف نشده ولی شده نمی دونم منظورش چیه
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style2 {color: #FF9900; }
-->
</style>
</head>
<body>
<form method="POST" action="register.php">
<table width="293" border="1">
<tr>
<td width="88" bgcolor="#333333"><div align="center" class="style2">username</div></td>
<td width="189" bgcolor="#333333"><label>
<input name="user" type="text" id="user" />
</label></td>
</tr>
<tr>
<td height="41" bgcolor="#333333"><div align="center" class="style2">password</div></td>
<td bgcolor="#333333"><label>
<input name="pass" type="password" id="pass" />
</label></td>
</tr>
<td height="43" bgcolor="#333333"><div align="center" class="style2">Email</div></td>
<td bgcolor="#333333"><label>
<input name="email" type="text" id="email" maxlength="70" />
</label></td>
<tr>
<td height="47" colspan="2" bgcolor="#99FF00"><label>
<div align="center">
<input type="submit" name="Submit" value="Submit" />
</div>
</label></td>
</tr>
</table>
</form>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<?php
//retrieve form variable
$user = $_POST['user'];
$pass = $_POST['pass'];
$email=$_POST['email'];
if(strlen($user) == 0 || strlen($pass) == 0 )
{
echo "lotfan forme sabtenam ra kamel por konid!";
exit;
}
// connect to db
$db = mysql_connect("localhost","root","");
if(!$db)
{
echo "can not connect to db";
exit;
}
mysql_select_db('usertest');
$query = " insert into admin
(user,pass,email)values
('".$user."','".$pass."','".$email."')";
$result = mysql_query($query);
if($result)
echo mysql_affected_rows().'<b> registred is success fully</br>';
mysql_close($db);
?>
</body>
</html>
اول وقتی فقط نام کاربری و پسورد بود ایراد نمیگرفت ولی وقتی ایمیل رو هم اضافه کردم این ارور رو میده
Notice: Undefined index: email in C:\wamp\www\regi\user\register.php on line 13
میگه ایمیل تعریف نشده ولی شده نمی دونم منظورش چیه