PDA

View Full Version : علت بروز این خطا چیه؟



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


میگه ایمیل تعریف نشده ولی شده نمی دونم منظورش چیه

Arthas1990
چهارشنبه 27 مهر 1390, 19:05 عصر
من که اجراش کردم هیچ خطایی نمیده!!!!:متعجب: همین فایلا رو باز میکنی خطا میده ؟!!!:متفکر:

css-man
چهارشنبه 27 مهر 1390, 19:09 عصر
اره

همین الان یکی دیگه عین همین نوشتم درست شد هیچ مشگلی هم نداشت نمی دونم چرا این یکی کار نمی کرد
دسدت درد نکنه

Arthas1990
پنج شنبه 28 مهر 1390, 04:58 صبح
اره

همین الان یکی دیگه عین همین نوشتم درست شد هیچ مشگلی هم نداشت نمی دونم چرا این یکی کار نمی کرد
دسدت درد نکنه
من که کاری نکردم . اما خوشحال میشدم کمک کنم :لبخند:

tux-world
پنج شنبه 28 مهر 1390, 11:00 صبح
این مشکل عمدتا به خود xampp برمیگرده برای همین هیچ موقع ازش استفاده نمیکنم . خودم از آپاچی لینوکس برای طراحی استفاده میکنم چون مطمئن تره

css-man
پنج شنبه 28 مهر 1390, 13:39 عصر
من wamp استفاده میکنم

lilac8
شنبه 04 خرداد 1392, 12:31 عصر
من یک فرم دارم دارای یک


<textarea name="cm" id="textarea" cols="60" rows="6"></textarea>

بعد داخل همون صفحه
دارم

$comment=$_POST['cm'];


اما نوتیک
Notice: Undefined index: cm

رو به من میده

واقعا مشکل کجاست؟

pcseven
شنبه 04 خرداد 1392, 12:46 عصر
من یک فرم دارم دارای یک


<textarea name="cm" id="textarea" cols="60" rows="6"></textarea>

بعد داخل همون صفحه
دارم

$comment=$_POST['cm'];


اما نوتیک
Notice: Undefined index: cm

رو به من میده

واقعا مشکل کجاست؟

ابتدا سورس صفحه را در http://validator.w3.org از بابت صحت کدهای HTML چک کنید، اگر مشکلی نداشت سورس مبدأ و مقصد را در همین بخش قرار دهید تا بررسی شود.