Php Hurdle

Reply

Join Date: Nov 2008
Posts: 2
Reputation: sajjadpk is an unknown quantity at this point 
Solved Threads: 0
sajjadpk sajjadpk is offline Offline
Newbie Poster

Php Hurdle

 
0
  #1
Nov 21st, 2008
Hi Every 1..!

I m new in DaniWeb plz help me out by solving my problm spcific to PHP (checkbox control).
I want delete multilple data from mysql using php form checkbox control.
I want to display data in a table as i did and then want to select multiple choices using checkboxs to delete it.
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 24
Reputation: sasankasekhar is an unknown quantity at this point 
Solved Threads: 3
sasankasekhar's Avatar
sasankasekhar sasankasekhar is offline Offline
Newbie Poster

Re: Php Hurdle

 
0
  #2
Nov 22nd, 2008
Consider the following:
<?php
if(isset($_POST['btnDelete'])){
	for($i=1;$i<=4;$i++){
		if(isset($_POST['checkbox'.$i])){
			echo "<br>".$_POST['checkbox'.$i];
		}
	}
}

?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form name="form1" method="post" action="">
  <table width="301" height="129" border="1" cellpadding="0" cellspacing="1">
    <tr> 
      <td width="21"><strong>Sl</strong></td>
      <td width="245"><strong>Item</strong></td>
      <td width="31"><strong>Tick</strong></td>
    </tr>
    <tr> 
      <td>1</td>
      <td>Apple</td>
      <td><input type="checkbox" name="checkbox1" value="Apple"></td>
    </tr>
    <tr> 
      <td>2</td>
      <td>Baby</td>
      <td><input type="checkbox" name="checkbox2" value="Baby"></td>
    </tr>
    <tr> 
      <td>3</td>
      <td>Cat</td>
      <td><input type="checkbox" name="checkbox3" value="Cat"></td>
    </tr>
    <tr> 
      <td>4</td>
      <td>Dog</td>
      <td><input type="checkbox" name="checkbox4" value="Dog"></td>
    </tr>
    <tr> 
      <td>&nbsp;</td>
      <td><input type="submit" name="btnDelete" value="Delete"></td>
      <td>&nbsp;</td>
    </tr>
  </table>
</form>
</body>
</html>

Hope this would help.
IF SOMEONE FEELS THAT THEY HAD NEVER MADE A MISTAKE IN THEIR LIFE, THEN  IT MEANS THEY HAD NEVER TRIED A NEW THING IN THEIR LIFE
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC