943,882 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 364
  • PHP RSS
Nov 21st, 2008
0

Php Hurdle

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sajjadpk is offline Offline
2 posts
since Nov 2008
Nov 22nd, 2008
0

Re: Php Hurdle

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.
Reputation Points: 10
Solved Threads: 3
Newbie Poster
sasankasekhar is offline Offline
24 posts
since Jan 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: php -> classes problem
Next Thread in PHP Forum Timeline: Connection problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC