الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

update form ما تشتغل...ساعدوووووني

مغلق
بدأه kyoti في 21 مايو 2006 · 2 رد · 409 مشاهدة · في منتدى تطوير المواقع بـ PHP
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

عند form يسوي Update لمعلومات الكتب الform يشتغل بس الupdate الاصلية ما تطيع تشتغل

هذي هي ال update form

 
  $host	  = "localhost";
 $user	  = "";
 $password  = "";

 $db		= "store";
 $table	 = "manga";


	 $conn=mysql_connect($host,$user,$password) or die("Failed to connect");
	 mysql_select_db($db) or die("Falied to select database");



	 echo "<table cellpadding=\"0\" cellspacing=\"0\" width=\"348\">
	<!-- MSTableType=\"layout\" -->
	<tr>
		<td height=\"46\">
		<p align=\"center\"><font face=\"Aharoni\" color=\"#808000\"><b>Use the form to modify the manga information </b></font></td>
	</tr>
</table> ";


	// $code = $_POST['name'];
	 $id = $_GET['id'];
	 $sql = "SELECT * FROM $table WHERE id = '$id'";
	 $result = mysql_query($sql);
	 //if the querey was executd

	  if ($result){
		while ($myrow = mysql_fetch_array($result)){

	 echo "<form method=\"POST\" enctype=\"multipart/form-data\" action= manga_update.php>
	<!--webbot bot=\"FileUpload\" U-File=\"fpweb:/_private/form_results.csv\" S-Format=\"TEXT/CSV\" S-Label-Fields=\"TRUE\" -->
	<input type=hidden name=id value=$myrow[id]><p>
	<p dir=\"ltr\" align=\"center\"><font face=\"Arial Narrow\"><b><label for=\"fp1\"> Article Code</label></b><input name=\"code\" size=\"20\" id=\"fp1\" value=$myrow[1]></font></p>
	<p dir=\"ltr\" align=\"center\"><font face=\"Arial Narrow\"><label for=\"fp2\">
	<b> Manga Name: </b> </label><input type=\"text\" name=\"name\" size=\"20\" id=\"fp2\" value=$myrow[2]></font></p>
	<p dir=\"ltr\" align=\"center\"><font face=\"Arial Narrow\"><label for=\"fp3\">
	<b> Author: </b></label><input type=\"text\" name=\"author\" size=\"20\" id=\"fp3\" value=$myrow[3]></font></p>
	<p dir=\"ltr\" align=\"center\"><font face=\"Arial Narrow\"><label for=\"fp4\">
	<b>price:</b></label><input type=\"text\" name=\"price\" size=\"20\" id=\"fp4\" value=$myrow[4]></font></p>
	<p dir=\"ltr\" align=\"center\"><label for=\"fp5\">
	<font face=\"Arial Narrow\"><b> Language:</b> </font> </label>
	<font face=\"Arial Narrow\"><input type=\"text\" name=\"language\" size=\"20\" id=\"fp5\" value=$myrow[5]></font></p>
	<p dir=\"ltr\" align=\"center\">
	<font face=\"Arial Narrow\">
	<b>Stock Status:</b>
	in stock<b> </b>
	<input type=\"radio\" value=\"inStock\" name=\"status\"> back ordered<input type=\"radio\" name=\"status\" value=\"backOrdered\"></font></p>
	<p dir=\"ltr\" align=\"center\"><label for=\"fp6\"><font face=\"Arial Narrow\"><b>
	Category:</b> </font>
	</label><font face=\"Arial Narrow\"><select size=\"1\" name=\"cato\" id=\"fp6\" value=$myrow[7] >
	<option selected>$myrow[7]</option>
	<option >----------</option>
	<option value = \"drama\">drama</option>
	<option value=\"comedy\">comedy</option>
	<option value=\"romance\">romance</option>
	<option value=\"action\">action</option>
	<option value=\"horror\">horror</option>
	</select></font></p>
	<p dir=\"ltr\" align=\"center\"><label for=\"fp7\"><font face=\"Arial Narrow\"><b>number of volumes</b>:<b> </b>
	</font>
	</label><font face=\"Arial Narrow\"><select size=\"1\" name=\"nvolumes\" id=\"fp7\" value=$myrow[8]>
	 <option selected>$myrow[8]</option>
	<option value=\"1\">1</option>
	<option value=\"2\">2</option>
	<option value=\"3\">3</option>
	<option value=\"4\">4</option>
	<option value=\"5\">5</option>
	<option value=\"6\">6</option>
	<option value=\"7\">7</option>
	<option value=\"8\">8</option>
	<option value=\"9\">9</option>
	<option value=\"10\">10</option>
	<option value=\"11\">11</option>
	<option value=\"12\">12</option>
	<option value=\"13\">13</option>
	<option value=\"14\">14</option>
	<option value=\"15\">15</option>
	<option value=\"16\">16</option>
	<option value=\"17\">17</option>
	<option value=\"18\">18</option>
	<option value=\"19\">19</option>
	<option value=\"20\">20</option>
	</select></font></p>
	<p dir=\"ltr\" align=\"center\"><label for=\"fp8\"><font face=\"Arial Narrow\"><b>
	Cover Page</b>: </font></label>
	<font face=\"Arial Narrow\">
	<input type=\"file\" name=\"form_data\" size=\"20\" id=\"fp8\" value=$myrow[9]></font></p>
	<p dir=\"ltr\" align=\"center\"><font face=\"Arial Narrow\"><b>
	Description</b>:</font></p>
	<p dir=\"ltr\" align=\"center\"><font face=\"Arial Narrow\"><textarea rows=\"10\" name=\"description\" cols=\"42\" value=>$myrow[10]</textarea></font></p>
	<p dir=\"ltr\" align=\"center\"><font face=\"Arial Narrow\"><b>Licensed</b> :
	<input type=\"checkbox\" name=\"licsd\" value=$myrow[11]><b>Complete:
	</b><input type=\"checkbox\" name=\"compl\" value=$myrow[12]></font></p>
	<p dir=\"ltr\" align=\"center\"><font face=\"Arial Narrow\"><input type=\"submit\" value=\"Submit\" name=\"B1\"><input type=\"reset\" value=\"Reset\" name=\"B2\"></font></p>
</form> ";
		}
	}else{
	  echo mysql_error($conn);
	  }

المشكلة في هذي اللي تحت

 $host	  = "localhost";
 $user	  = "";
 $password  = "";

 $db		= "store";
 $table	 = "manga";




	$id	   =$_POST['id'];
	$code	 = $_POST['code'];
	$name	 = $_POST['name'];
	$author   = $_POST['author'];
	$price	= $_POST['price'];
	$lang	 = $_POST['language'];
	$status   =  $_POST['status'];
	$cato	 =  $_POST['cato'];
	$volumes  =  $_POST['nvolumes'];
	$desc = $_POST['description'];
	$lics = $_POST['licsd'];
	$comp  = $_POST['compl'];

	$sql = ("UPDATE $table SET  code='$code',manga_name = '$name', author = '$author',
	pd_price ='$price',language ='$lang',status = '$status',cato ='$cato',n-volumes = '$volumes',
	image-name = '$form_data_name',desc = '$desc',
	Licensed = '$lics', complete = '$comp' WHERE id = '$id'");

	 $conn=mysql_connect($host,$user,$password) or die("Failed to connect");
	 mysql_select_db($db) or die("Falied to select database");


	if(mysql_query($sql)){

	 echo"the infromation was updated successfuly";
	 echo"<p><br>click <a href=manga_details.php?id=$myrow[id]>here</a> to view this manga details
		  <br>click <a href=manga_display.php?id=$myrow[id]>here</a> to view the manga list </p>";

	}else{

	  echo mysql_error();
	}

تم تعديل هذه المشاركة بواسطة kyoti في 21 مايو 2006 في 23:49

#2

السلام عليكم ورحمة الله وبركاته

سؤال : كيف أنشأت حقول تحتوي على علامة (-) .

460.gif

#3

dear

i think you will modify your code

1- the variables returned from mysql_fetch_array as folllow

$myrow=mysql_fetch_aarray($result)

then take the variables first like this

$vaiable1= $myrow["columnName1"];

$variable2=$myrow["columnName1"]l

wahakaza

2-then give the value for this variables ($variable1,variable 2 ..........) wahakaza to the html input values including the (ID)

3-then post this variable from the form and give the form and the inputs the same id as the variable ID

3- execute your query where the posted ID

هذا الموضوع مغلق.

مواضيع مشابهة

عدد الزوار حالياً

المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية

—الإجمالي—أعضاء مسجّلون—زوار بدون تسجيل

جارٍ التحقق من المتواجدين…