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

مشكلة تأكيد الحذف مع الجافاسكربت...

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

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

كل عام و انتم بخير

مشكلتي يا أخوان عندي هذا الكود

include('config.php');
$suppliers=mysql_query("SELECT * FROM supplier ORDER BY supplier_id DESC");
.
.
.
While($res=mysql_fetch_object($suppliers)){
?>
<div align="center">
  <table border="0" width="90%" class="bodytbl">
		 <tr>
			 <td width="02%"><p align="left"><?=$res->supplier_id?></p></td>
			 <td width="10%"><p align="left"><?=$res->supplier_name?></p></td>
			 <td width="10%"><p align="left"><?=$res->first_name?></p></td>
			 <td width="10%"><p align="left"><?=$res->last_name?></p></td>
			 <td width="20%"><p align="left"><?=$res->email?></p></td>
			 <td width="10%"><p align="left"><?=$res->mobile?></p></td>
			 <td width="05%"><p align="left"><?=$res->activation?></p></td>
			 <td width="15%"><p align="left"><?=$res->registration_date?></p></td>
			 <td width="09%"><p align="left">
			 <script type="text/javascript">
			 <!--
			 function disp_confirm(){
				 var r=confirm("Are You Sure to delete this Supplier?")
				 if(r==true){
//					 alert("supplier_id=<?=$res->supplier_id?>")
					 document.location.href="delete_supplier.php?supplier_id=<?=$res->supplier_id?>"
				 }
				 else
				 {
					 document.location.href="suppliers.php"
				 }
			 }
			 -->
			 </script>
			 <input type="submit" value="Delete" onclick="disp_confirm()" style="border:0; font-weight : bold;"></p></td>

فالناتج من عملية الحذف انه يحذف لي أصغر قيمة من ال (SUPPLIER_ID) و المفروض انه يحدد لي قيمة الاي دي المراد حذفها

فشو الغلط اللي بالكود هذا .... لأني صراحة مالي خبرة بالجافا سكربت ؟؟

أتمنى منكم المساعدة

أخوكم سامي

#2

المشكلة ان نفس الاجرائية function لحذف ال SUPPIER_ID له نفس الاسم لجميع ال SUPPIER_IDs

هذه الكود الجديد يحل المشكلة

include('config.php');
$suppliers=mysql_query("SELECT * FROM supplier ORDER BY supplier_id DESC");
.
.
.
While($res=mysql_fetch_object($suppliers)){
?>
<div align="center">
  <table border="0" width="90%" class="bodytbl">
		 <tr>
			 <td width="02%"><p align="left"><?=$res->supplier_id?></p></td>
			 <td width="10%"><p align="left"><?=$res->supplier_name?></p></td>
			 <td width="10%"><p align="left"><?=$res->first_name?></p></td>
			 <td width="10%"><p align="left"><?=$res->last_name?></p></td>
			 <td width="20%"><p align="left"><?=$res->email?></p></td>
			 <td width="10%"><p align="left"><?=$res->mobile?></p></td>
			 <td width="05%"><p align="left"><?=$res->activation?></p></td>
			 <td width="15%"><p align="left"><?=$res->registration_date?></p></td>
			 <td width="09%"><p align="left">
			 <script type="text/javascript">
			 <!--
			 function disp_confirm<?=$res->supplier_id ?>(){
				 var r=confirm("Are You Sure to delete this Supplier?")
				 if(r==true){
//					 alert("supplier_id=<?=$res->supplier_id?>")
					 document.location.href="delete_supplier.php?supplier_id=<?=$res->supplier_id?>"
				 }
				 else
				 {
					 document.location.href="suppliers.php"
				 }
			 }
			 -->
			 </script>
			 <input type="submit" value="Delete" onclick="disp_confirm()<?=$res->supplier_id?>" style="border:0; font-weight : bold;"></p>
			</td>

تحياتي

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

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