السلام عليكم
بصرااحة في مشكلة دوختني وهي انه البيانات عند ادخالها بصفحة التسجيل لا تتنتقل الى الداتا بيس لا اعرف اين المشكلة
هادا الكود لصفحة التسجيل
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Register Form </title>
</head>
<body bgcolor="#5A79B1">
<p> </p>
<p align="center">
<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="obj1" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="612" height="82">
<param name="movie" value="../../Users/admin/Users/admin/Documents/My Web Sites/prj1.swf">
<param name="quality" value="High">
<embed src="../../Users/admin/Users/admin/Documents/My%20Web%20Sites/prj1.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj1" width="612" height="82"></object>
</p>
<p> </p>
<table width="300" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td><form name="form1" method="post" action="insert_ac.php">
<table width="100%" border="2" cellspacing="1" cellpadding="3">
<tr>
<td colspan="3"><center><strong><font size="5" face="Arial Black">Registration Form
</font> </center> </strong></td>
</tr>
<tr>
<td width="71">
<p align="center"><b>Customer Name</b></td>
<td width="6">:</td>
<td width="301"><input name="cust_name" type="text" id="cust_name"></td>
</tr>
<tr>
<td>
<p align="center"><b>Customer City </b> </td>
<td>:</td>
<td><select name="cust_city">
<option value="city_no"></option>
<?php
mysql_connect('localhost','root','')or die("Couldn't connect to the database.");
mysql_select_db('jinan')or die("Couldn't select the database");
$query="Select city_name from city";
$result = mysql_query($query);
$num_results = mysql_num_rows($result);
for ($i=0; $i <$num_results; $i++)
{
$row[$i] = mysql_fetch_array($result);
echo" <option value=$row[$i][0]>".$row[$i][0]."</option>";
}
?>
</select></td>
</tr>
<tr>
<td>
<p align="center"><b>Customer Email</b></td>
<td>:</td>
<td><input name="cust_email" type="text" id="cust_email"></td>
</tr>
<tr>
<td>
<p align="center"><b>Customer Tel</b></td>
<td>:</td>
<td><input name="cust_tel" type="text" id="cust_tel"></td>
</tr>
<tr>
<td>
<p align="center"><b>Customer Mobile</b></td>
<td>:</td>
<td><input name="cust_mobile" type="text" id="cust_mobile"></td>
</tr>
<tr>
<td colspan="3" align="center"><input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
</body>
</html>والكود هذا لتخزين المعلومات ونقلها من الفورم الى الداتا بيس
اين المشكلة!!!!!
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 5</title>
</head>
<body>
<?php
$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="jinan"; // Database name
$tbl_name="customers"; // Table name
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// Get values from form
$cust_name=$_POST['cust_name'];
$cust_city=$_POST['city_no'];
$cust_email=$_POST['cust_email'];
$cust_tel=$_POST['cust_tel'];
$cust_mobile=$_POST['cust_mobile'];
// Insert data into mysql
$sql="INSERT INTO $tbl_name(cust_name,cust_city,cust_email,cust_tel,cust_mobile)VALUES('$cust_name', '$city_no', '$cust_email','$cust_tel','$cust_mobile')";
$result=mysql_query($sql);
// if successfully insert data into database, displays message "Successful".
if($result){
echo "You are succsessfuly register in our website";
echo "<BR>";
echo "<a href='insert.php'>Back to main page</a>";
}
else {
echo "Please refill your form and try again";
}
// close connection
mysql_close();
?>
</body>
</html>مع العلم انه هذا الفورم يتعامل مع جدولين في الداتا بس الأول هو جدول المدن المكون من "city_no , city_name
وهذا الجدول استخدمت المعلومات الموجودة فيه لعرض المدن في القائمة المنسدلة
والجدول الثاني هو لتخزين المعلومات التي يدخلها الكستمر في هذا الفورم وهو جدول مكون من
cust_no
cust_name
cust_city
cust_tel
cust_mobile
cust_email