Go Back   Webmaster Malaysia Forum » Website Design & Development » Website Programming

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 19-04-2002, 09:51 AM
uje's Avatar
uje uje is offline
New kid on the block
 
Join Date: Mar 2002
Posts: 5
Rep Power: 0
uje is on a distinguished road
Send a message via Yahoo to uje
Unhappy camna nak delete guna check box

aloo, kengkawan aku ada problem skit nih, camna nak buat delete guna check box cam dalam email tula, aku guna php4.0.5 ngan database mysql, kalu nak delete satu2 tu tau la aku ,,tolong yoo kengkawang kalu buleh bagila contoh yang lengkap siap nagn coding dio..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 19-04-2002, 10:24 AM
bazet's Avatar
Novice Webmaster
 
Join Date: Aug 2001
Location: Ampang KL
Posts: 93
Rep Power: 89
bazet is on a distinguished road
Send a message via ICQ to bazet Send a message via AIM to bazet Send a message via Yahoo to bazet
The Solution

Pertama sekali, gukana id yang unik untuk setai value checkbox dan berikan FORM NAME yang berakhiran dengan [] , contohnya padam[]

Sila lihat contoh di bawah :

PHP Code:
<!-- padam.html -->
<form action="padam.php" method="post">

<input type="checkbox" name="padam[]" value="1">
<input type="checkbox" name="padam[]" value="2">
<input type="checkbox" name="padam[]" value="3">
<input type="checkbox" name="padam[]" value="4">
<input type="checkbox" name="padam[]" value="5">
<input type="checkbox" name="padam[]" value="6">

<input type="submit" value="Padam">
</form>


<?
// 
// padam.php
// Proses fail untuk padam.html
//

/* check $padam adalah array */
if(is_array($padam))
{
   
    
/* gunakan foreach untuk print nilai padam */

    
foreach($padam as $data)
    {
         echo 
$data;
         echo 
"<br>";
        
/* Buat proses pemadaman di sini */
     
}

} else {
   echo 
" Tiada Data Dipilih ";
}

?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 19-04-2002, 12:24 PM
uje's Avatar
uje uje is offline
New kid on the block
 
Join Date: Mar 2002
Posts: 5
Rep Power: 0
uje is on a distinguished road
Send a message via Yahoo to uje
thank bazet, tapi... ni contoh coding aku<?php
$db = mysql_connect("localhost", "");
mysql_select_db("sukns",$db);
$result = mysql_query("SELECT * FROM aduan ORDER BY nama ASC",$db);
$num = mysql_numrows($result);
?> </p>

<form method="post" action="cobaan3.php4">
<?
echo "<TABLE BORDER=2>";
while ($myrow = mysql_fetch_array($result))

{
echo "<TR><TD>";
echo $myrow["hari"];
echo "/";
echo $myrow["bulan"];
echo "/";
echo $myrow["tahun"];
echo "<TD>";
echo $myrow["nama"];
echo "<TD>";
echo $myrow["jabatan"];
echo "<TD>";
echo $myrow["no_tel"];
echo "<TD>";
echo $myrow["jenis"];
echo "<TD>";
echo $myrow["tek_staf"];
echo "<TD>";

?>
<td>

<input type="checkbox" name="del[<? echo $num ?>]" value="on">

</td>

<?
}
echo "</TABLE>";

?>

coding ni akan papar nilai data dalam database ngan check box kat ujung setiap table tu so camna aku nak padam bila aku tanda check yang ada kat ujung dia tu..
bule ker guna method diatas , tolong yo bazet
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 19-04-2002, 05:03 PM
bazet's Avatar
Novice Webmaster
 
Join Date: Aug 2001
Location: Ampang KL
Posts: 93
Rep Power: 89
bazet is on a distinguished road
Send a message via ICQ to bazet Send a message via AIM to bazet Send a message via Yahoo to bazet
Ohh listing pun awak guna PHP yerk

senang aja,,,just assign unik id untuk setiap checkbox

cth

user : mazreha
id : 1

user : azril
id =2

user : imaz
id =3

HTML awak akan berbetuk cam gini
PHP Code:
Mazreha = <input type="checkbox" name="nama[]" id="1">
<
br>
Azril = <input type="checkbox" name="nama[]" id="2">
<
br>
Imaz = <input type="checkbox" name="nama[]" id="3"
so, bila user submit, function foreach() akan mengambil nilai id $name dan awak lakukan SQl delete dalam loop
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 23-04-2002, 01:04 PM
Novice Webmaster
 
Join Date: Mar 2002
Location: -
Posts: 15
Rep Power: 0
nuha is on a distinguished road
Send a message via Yahoo to nuha
akum, tu kalu utk 1 button delete jer, kalu bayk button lak camner?cth nyer ader button edit, delete & update camenr(mcm dlm geocities->file manager) tu lah.harap dpt bantu
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 26-04-2002, 02:37 PM
uje's Avatar
uje uje is offline
New kid on the block
 
Join Date: Mar 2002
Posts: 5
Rep Power: 0
uje is on a distinguished road
Send a message via Yahoo to uje
okey masa masa ko papar data dari database tu ko taruk sekali satu button delete kat situ yang mewakili data base tu
cam niecho
<a href=\"delete.php?id=".$myrow[primary key dari database]."\">button delete</a>
aaaa lepaih tu ko buleh la buat function delete kat delete.php
tu lakot
saya budak baru belajar kalu salah tolong tunjukkan...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 29-04-2002, 10:04 AM
uje's Avatar
uje uje is offline
New kid on the block
 
Join Date: Mar 2002
Posts: 5
Rep Power: 0
uje is on a distinguished road
Send a message via Yahoo to uje
thank bazet, ianya berjalan seperti yang diharapkan...
mana ko belajar php ni ha.. terer semacam jer, sebenonya, aku ni tgh praktikal kat satu kompeni, diorang suruh aku buat satu aplikasi pakai php tu yang letih tu pasal aku takde banyak engalaman sgat tu, aku nak mintak sedikit tunjuk ajar dari ko..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 02-05-2002, 10:35 AM
Novice Webmaster
 
Join Date: Mar 2002
Location: -
Posts: 15
Rep Power: 0
nuha is on a distinguished road
Send a message via Yahoo to nuha
akum, saya pun nak tanya gak sesaper yg ilmu lebih la....
tu kalu nok delete so 1 function jer, katakan kalu kener wat 3 function serentak, cthnyer, delete, edit, & add.Boleh tak korang bg idea & coding nyer nan complete.Senang nak rujuk.

-----------------------------------------------------------------
minda yang kecil membincangkan manusia
minda yang sederhana membincangkan peristiwa
minda yang besar membincangkan idea


<!--BabY MEraNGkaK-->
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Add, Update and Delete using ASP prompter46 Website Programming 6 25-04-2007 06:12 PM
Disable Delete & upload? how? Zapgirl Webmaster Tools 2 19-11-2005 12:21 AM
cara nak delete data miss_tlot Website Programming 9 25-09-2003 12:25 PM
camner nak wat delete/edit/update gunakan check box nuha Website Programming 1 23-04-2002 03:33 PM



All times are GMT +8. The time now is 11:05 AM. Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0 vBulletin skin by ForumMonkeys.com.


WebmasterMalaysia.com is Proudly Hosted by Exabytes Semi Dedicated Server.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59