Jump to content

shiva

Members
  • Posts

    7
  • Joined

  • Last visited

Posts posted by shiva

  1. Hi Any body help me how to delete selected checkbox. I want delete databases entry's through my browser , when i select the checkbox entry's and delete the entry's it was deleted in databases. my code is below please edit and give for me.

    <html><head><script language="JavaScript">  </script> <script type="text/javascript"><!--/* This script and many more are available free online atThe JavaScript Source :: [url="http://javascript.internet.com"]http://javascript.internet.com[/url]Created by: Thony den Braber :: [url="http://www.orangespirits.nl"]http://www.orangespirits.nl[/url] */function select_row(row, color) {  if(row.parentNode.parentNode.style.backgroundColor != color) {    row.parentNode.parentNode.style.backgroundColor = color;    row.parentNode.parentNode.className = 'DOPrint'  } else {  row.parentNode.parentNode.style.backgroundColor = '';  row.parentNode.parentNode.className = 'DONTprint'  }}function mouseover(row, font_color, checkedcolor) {  if(row.style.color != checkedcolor) {    row.style.color = font_color;  }}function mouseout(row, font_color, checkedcolor) {  if(row.style.color != checkedcolor) {    row.style.color = font_color;  }}function Checkall(form){   for (var i = 1; i < form.elements.length; i++){        eval("form.elements[" + i + "].checked = form.elements[0].checked");    } }// --></script></head><style>.colc{font-family: san-serif;color: beceac;}.colc:hover{font-family: san-serif;color: GREEN;}</style></head><body bgcolor="f7f7f7"> <center>  <table border=1  height=50 width=988 background="images/1212.gif" align=center>   <tr>	<td>	   <font color=464656 size=5>		<center><u><b><i><div align=center> </div>(..)Database</i></b><u><center>	  </font>	</td>   </tr>  </table><script language = javascript>		function check()		{			alert ("Are you sure want to delete this");		}</script><!----right table-----!><table border=1 width=120 height=500 align=right background="./1212.gif"><tr>	<td valign=top background="images/1212.gif">		<center>link<center>		<a href="http://localhost/HIOX/hscripts/freeimages/icons/statistics/january.php" class="colc"><img src="images/webshot.jpg", align=center></a>	</td></tr></table><!----left table-----!><table border=1 width=115 height=500 align=left background="images/1212.gif"><tr>	<td valign=top background="images/1212.gif">		<center><font color=3453656><b>Database adding tools  <img src="images/images1.jpg"><center></font>		<font color=23647>		<a href="http://localhost/sasi/databaseleanering-2/new-database-creating.php" style="color: 23647; font-size: 15px; text-decoration: none;">		<hr>Browser statistics		<hr><a href="http://localhost/sasi/databaseleanering-2/os.php" style="color: 23647; font-size: 15px; text-decoration: none;">              OS Windows Statistics  </a>		<hr>Display resolution & Color Depth  		<hr>Net users statistics  		<hr>world population statistics 		<hr size=2></b></font>	</td></tr></table><!----center1-----!><table border=0 valign=top width=740 background="images/center1.jpg" align=center><tr>	<td>		<center>		<b>Browser Statistics</b>		</center>	</td></tr></table><!----statistics adding background table-----!><table border=0 width=740 height=800 bgcolor=#e7e7e7 align=center><tr>	<td valign=top>	<form action="<?php echo $PHP_SELF;?>" method=post>           <table border="0" cellpadding="0" cellspacing="0" width="0%">             <tbody>		 <tr>                <td valign="top" width="0%"><img src="images/lr.gif" height="19" width="5"></td>                <td class="MH2" background="images/lr.gif" width="0%"><b>Browser options</b></td>                <td valign="top" width="0%"><img src="images/lr.gif" height="19" width="5"></td>             </tr></tbody>            </table>            <table style="border: 1px solid rgb(190, 205, 240);" bgcolor="#f7f7f7" border="0" cellpadding="0" cellspacing="0" height="0%" width="16%">            <tr valign="top">		   <td>	            <center><font color=red><a href="new-database-creating.php"> *Add browser </a></red></center>               </td> 		</tr>		</table>		<table border=1 background="images/top.gif"  cellpading=0 height=0 width=0 align="center">		<tr>			<td background="images/bottom.gif"><b><center>Month</center></b></td>			<td background="images/bottom.gif"><b><center>Year</center></td>		</tr>		<tr>			<td>         <input type="checkbox" onClick="Checkall(this.form);"/>			<select name="month1"><option value="January">January</option><option value="February" selected="selected">February</option>				<option value="March" selected="selected">March</option><option value="April" selected="selected">April</option>				<option value="May" selected="selected">May</option><option value="June" selected="selected">June</option>				<option value="July" selected="selected">July</option><option value="August" selected="selected">August</option>				<option value="September" selected="selected">September</option><option value="October" selected="selected">October</option>				<option value="November" selected="selected">November</option><option value="December" selected="selected">December</option>			</select>			</td>				<td>			<select name="year1"><option value="2005">2005</option><option value="2006" selected="selected">2006</option>				<option value="2007" selected="selected">2007</option><option value="2008" selected="selected">2008</option>				<option value="2009" selected="selected">2009</option><option value="2010" selected="selected">2010</option>				<option value="2011" selected="selected">2011</option><option value="2012" selected="selected">2012</option>		      </select>			</td>			<td>				<input type="submit" >		</tr>		</table><br><center><?php      $selid= array();      $year = $_POST['year1'];      $month = $_POST['month1'];	$link = mysql_connect (localhost, root, "" );   	mysql_select_db (stat);	if(!$year)	{		$year=2012;		$month='December';	}		$query = "select distinct * from stat where month = '$month' && year = '$year'";	$result = mysql_query($query) or die("Query failed : " . mysql_error());	echo "<form name=de action='<?php echo $PHP_SELF;?>' method=post>";	echo "<input type=hidden name=function>";	echo "<table border=1 id=\"delete\" background=\"images/1212.gif\">\n"; 	echo"<tr><td></td>           <td background=\"images/top.gif\"><center><font color=green size=><b>ID</center></td>		<td background=\"images/top.gif\"><center><font color=green size=><b>Browser</center></td>		<td background=\"images/top.gif\"><center><font color=green size=><b>Hits</center></td>		<td background=\"images/top.gif\"><center><font color=green size=><b>Types<center></td>		<td background=\"images/top.gif\"><center><font color=green size=><b>Year</center></td>		<td background=\"images/top.gif\"><center><font color=green size=><b>Month</center></td>";	$i=1;	$count=mysql_num_rows($result);	while ($line = mysql_fetch_array($result, MYSQL_NUM)) 	{			echo "--------$line[0]";    		echo "\t<tr onmouseover=\"mouseover(this,'#cc6600','#cc6600');\" onmouseout=\"mouseout(this,'black','#000000')\" class='DONTPrint'>\n";		echo"<td background=\"images/1212.gif\" >";	      echo"<input type=\"checkbox\"/ onclick=\"select_row(this, 'white' );\">"; 		//echo "<input type=\"checkbox\" name=cb$i id=cb$i value=$line[0]>";       	echo "<input type=hidden id=ischk$i>";		echo"</td>";			foreach ($line as $col_value) 		{	        echo "\t\t<td><b>$col_value</td></b>\n";            		}	   	echo "\t</tr>\n";		$i++;	}	echo "</table>\n";	echo "<input type=hidden name=selid>";//	echo "<input type=button name=delete value=Delete onClick=\"del()\">";      echo "<input type=\"submit\" onclick=del(this.form) value=\"delete\">";     echo "</form>";?>	<script language = javascript>function del(frm){ var delarr = new Array(); var e = frm.elements; var l = (typeof(e.length) == "undefined") ? 0 : e.length; var iCount = 0; for(i=0;i<l;i++) {	 if(e[i].type == "checkbox")	 {		 if(e[i].checked)		 {				 	delarr.push(e[i].value);			iCount++;		 }	 } } if(iCount == 0 ) {	alert("Please select items to delete!"); 	return false; }   var con = confirm("Are you sure you want to delete this.");   if (con)  {	for(var m=0;m<delarr.length;m++)	{	<?php	$link = mysql_connect (localhost, root, "" );	if($link)	{		echo "(\"$id =\"+ delarr[m]);";		$qry = "delete from stat where id ='$id'";		mysql_query($qry,$link);	}	?>   	}  }  else  {}}</script><table border=0 valign=bottom width=740 height=25 background="images/center1.jpg" align=center><tr><td></td></tr></table>

  2. Hi This is a code. Anybody chage this javascript code to intergrate to php. <script language = javascript> function del(frm){ var delarr = new Array(); var e = frm.elements; var l = (typeof(e.length) == "undefined") ? 0 : e.length; var iCount = 0; for(i=0;i<l;i++) { if(e.type == "checkbox") { if(e.checked) { delarr.push(e.value); iCount++; } } } if(iCount == 0 ) { alert("Please select items to delete!"); return false; } var con = confirm("Are you sure you want to delete this."); if (con) { for(var m=0;m<delarr.length;m++) { <?php $link = mysql_connect (localhost, root, "" ); if($link) { echo "(\"$id =\"+ delarr[m]);"; $qry = "delete from anand where id ='$id'"; mysql_query($qry,$link); } ?> } } else {}}</script>

×
×
  • Create New...