how to make check box for deleta all on inbox sms gateway

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
idoramones
Forum Newbie
Posts: 3
Joined: Thu Jul 01, 2010 4:14 am

how to make check box for deleta all on inbox sms gateway

Post by idoramones »

please corect my code....

Code: Select all

<html>
<head>
<title>Inbox</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">
<!--
body {
	background-color: #008800;
}
-->
</style></head>
<script type="text/javascript">
	function delayer(){
		document.location="inbox.php"
		}
	
	function pilih_semua (jumlah)
	{var i;
	for (i=0; i < jumlah; i++)
	document.getElementById ("checkdata" + i).checked=true;
	}catch (e) {
		alert (e);
		}
		}
	
		return false;
	}
	
	function kosong_semua (jumlah)
	{ 
		var i;
		for (i=0; < jumlah; i++)
		document.getElementById("checkdata"+ i).checked=false;
		
		return false;
		}
	function konfirmasi ()
	{
	var objek =document.getElementsByTagname ("input");
		var jumlah =(objek.length -2) /2;
		var total =0;
		var teks ="";
		var ReceivingDateTime;
		var pemisah;
		
		for (i=0; i<jumlah; i++)
		{
			if (document.getElementById (
				"checkdata" +1). checked == true)
					{
						total++;
						
						ReceivingDateTime= getElementById ("hidden" +1).value;
						
						if (teks = "")
							pemisah ="";
							else
							pemisah = "-";
							teks =teks +pemisah + nip;
							}
				}
				if (total >0)
				{
				
				var jawaban =confirm ("Anda akan menghapus pesan berikut?\n" + teks);
					return jawaban ;
				}
				else
				alert ("silahkan pilih dulu data yang akan dihapus");
				
				return false;
				}
							
	
function confirmation() {
	var answer = confirm("Hapus pesan ini?")
	if (answer){
		alert("Pesan Terhapus")
		window.location = "inbox.php";
	}
	else{
		window.location = "inbox.php";
	}
}
</script>

<body onLoad="setTimeout ('delayer()',100000)">
<div align=center>
<table width=65% bgcolor=#FFFFFF >
	<tr>
		<td width=10% align=center>
			<a href=inbox.php><img src="image/inbox-48.png" title="inbox" alt="inbox" border=0></a>
		</td>
		<td width=10% align=center>
			<a href=outbox.php><img src="image/send_48.png" title="kirim pesan" alt="kirim pesan" border=0 ></a>
		</td>
		<td width=10% align=center>
			<a href=sentitem.php><img src="image/database_server_48.png" title="pesan terkirim" alt="pesan terkirim" border=0 ></a>
		</td>
		<td width=10% align=center>
			<a href=info.php><img src="image/info-icon.png" title="info" alt="info" border=0></a>
		</td>
	</tr>
</table>
</div>
<?php
	require ("connectDB.php");
	$link=koneksidb();
	$tablename="inbox";
	

	$sqlstr="SELECT ReceivingDateTime,SenderNumber,TextDecoded,ID FROM $tablename order by ReceivingDateTime desc ";
	
	$result = mysql_query ($sqlstr) or die("kesalahan pada sintak sql");
	

	mysql_close($link);
	
	echo("<div align=center><table width=60% border=0 width=100% cellspacing=1 cellpadding=2 bgcolor=#0099CC>");
	echo("<tr><td bgcolor=#0099CC>Nomor</td><td bgcolor=#0099CC>Tanggal diterima</td><td bgcolor=#0099CC>Nomor Pengirim</td><td bgcolor=#0099CC>Pesan</td><td bgcolor=#0099CC>Balas</td><td bgcolor=#0099CC>Hapus</td></tr>");
	
	$i =0;
	while ($row = mysql_fetch_object ($result))
	
	

	{
	?>	<form action=reply.php method=post> <?
		$nomor=$nomor+1;
		$ReceivingDateTime=$row->ReceivingDateTime;
		$SenderNumber=$row->SenderNumber;
		$TextDecoded=$row->TextDecoded;
		$ID=$row->ID;
		
		//while ($row2 = mysql_fetch_object ($result2))
		//{
				$Name=$row2->Name;
		//}
		echo("<tr><td bgcolor=#00FFFF align=center>$nomor</td><td bgcolor=#00FFFF>$ReceivingDateTime</td><td bgcolor=#00FFFF>$SenderNumber</td><td bgcolor=#00FFFF>$TextDecoded</td><td bgcolor=#00FFFF>");
		?> <input type=image src="image/send_48.png" title="balas ke nomer <?echo($SenderNumber);?>" name=reply value="<?echo($SenderNumber);?>"></form> 
			 <form action=hapus.php method=post > <?
			echo("</td><td bgcolor=#00FFFF>");
		?>	<input type=image src="image/delete-icon.png" title="hapus" name=hapus value="<?echo($ID);?>"></form> 		
			 
				<form action=edit.php method=post> <?
				echo("</td><td bgcolor=#00FFFF>");
		?>	<input type="image" src="image/image/edit_f2.png" title="edit" name=edit value="<a href="edit.php?id='.$row["$ID"].;?></form>
		
			 <?
		echo("</td></tr>");


			

	}
	
		echo("</table>");
	
?>

</form>
</body>
</html>
	
	
	     



	
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Re: how to make check box for deleta all on inbox sms gatewa

Post by Jade »

How can we correct your code if we don't know what's wrong with it? Do you not understand the concept, are you getting error messages, what code have you put in place to try and accomplish the task you set out to complete?

A "delete all" basically needs to query the database and then remove all of the entries that match the inbox criteria. So for example:

Code: Select all

<?php
if ($_POST['delete_all'])
{
        mysql_query("DELETE FROM inbox WHERE uid='$user_id_goes_here' AND folder='INBOX'")
        or die (mysql_error());
}

<form action="#" method="post">
<input type="checkbox" name="delete_all" value="1" /> Click here to delete all messages<br/>
<center><input type="submit" name="submit" value="Save Changes" />
</form>
?>
idoramones
Forum Newbie
Posts: 3
Joined: Thu Jul 01, 2010 4:14 am

Re: how to make check box for deleta all on inbox sms gatewa

Post by idoramones »

:banghead: :crazy:

really2 need ur help.....
my consept is make sms interactive with marquee(scrolling)text lke in television ex: +6281340868822 : text massage => +6281470283748: text massage

: : now I have an affair to make the process by cekbox
where I wish to chosen the message beforehand use the which check box to be presented [by] its message
.....

teach me please...

sorry my english lng not good....^_^
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Re: how to make check box for deleta all on inbox sms gatewa

Post by Jade »

You can't do a scrolling marquee with php, that needs to be done via html <marquee> tag or via javascript.
idoramones
Forum Newbie
Posts: 3
Joined: Thu Jul 01, 2010 4:14 am

Re: how to make check box for deleta all on inbox sms gatewa

Post by idoramones »

my code is work before i make it like that

Code: Select all

 <html> 	   
 <div align="center"> <font style="color: #000000; font-size=16pt;">
 <marquee style="background-color: #FFFFFF;" direction="left" loop="-1"  width="100%" scrollamount="2" onMouseOut="this.start()" height="50">
 			   
        <?php
	
		
		$link=koneksidb ();
		$tablename="inbox";
	
           	
	$sqlstr="SELECT ReceivingDateTime,SenderNumber,TextDecoded, ID FROM $tablename order by ReceivingDateTime desc ";
	$result = mysql_query ($sqlstr) or die("kesalahan pada sintak sql");
	mysql_close($link);
	
	
            while ($row= mysql_fetch_array ($result))
            {
			
                $ReceivingDateTime =$row['ReceivingDateTime'] ;
                $SenderNumber =$row['SenderNumber'] ;
                $TextDecoded = $row['TextDecoded'];
             
        ?>
      
       
           <?php echo $SenderNumber."=".$TextDecoded."."; ?>  <img src="../sms/next_page.gif">
		   
                
				
     
 
        <?php
            }
		
        ?>
    </marquee>
	</font>
    </div>
	<font face="Geneva, Arial, Helvetica, sans-serif"> </font></font><font color="#66FF00" face="Geneva, Arial, Helvetica, sans-serif"><strong><em><blink>SMS INTERAKTIF</blink> </em></strong></font>

    </body>
</html>

my problem is : i want to choose massage before with check box to view massage with marquee......how to do that???? please tell me.. :((
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Re: how to make check box for deleta all on inbox sms gatewa

Post by Jade »

First you'd need to save the "checked" value in database for later use.

Code: Select all

<?php
//if they've pressed the save changes button and there is a message ID to update
if ($_POST['save'] && $_POST['id']) {
     //update the database to save the checked value
 
     mysql_query("UPDATE $tablename SET useMarquee='" . $_POST['scroll'] . "' WHERE ID='" . $_POST['id'] . "'"
     or die (mysql_error());

     echo "Changes saved!";

}
?>
<form action="#" method="post">
<?php
//You would show them the message and the scroll checkbox here

$result = mysql_query("SELECT * FROM $tablename WHERE id='$message_id'")
or die (mysql_error());

$row = mysql_fetch_array($result);

//display whatever you want from the message here

?>
<p>Scroll? <input type="checkbox" name="scroll" value="1" /></p>
<input type="hidden" name="id" value="<?php echo $message_id; //the message we want toggle the scroll for ?>" />
<p align="center"><input type="submit" name="save" value="Save Changes" />
</form>

Once you have that data in the table you need to do something like this:

Code: Select all

<html>            
 <div align="center"> <font style="color: #000000; font-size=16pt;">
                      
        <?php
       
               
                $link=koneksidb ();
                $tablename="inbox";
       
               
        $sqlstr="SELECT ReceivingDateTime,SenderNumber,TextDecoded, ID, useMarquee FROM $tablename order by ReceivingDateTime desc ";
        $result = mysql_query ($sqlstr) or die("kesalahan pada sintak sql");
        mysql_close($link);
       
       
            while ($row= mysql_fetch_array ($result))
            {
                       
                $ReceivingDateTime =$row['ReceivingDateTime'] ;
                $SenderNumber =$row['SenderNumber'] ;
                $TextDecoded = $row['TextDecoded'];
                $scroll = $row['useMarquee'];

                if ($scroll)
                    echo " <marquee style=\"background-color: #FFFFFF;\" direction=\"left\" loop=\"-1\"  width=\"100%\" scrollamount=\"2\" onMouseOut=\"this.start()\" height=\"50\">";

                echo $SenderNumber."=".$TextDecoded.". <img src=\"../sms/next_page.gif\">";

                if ($scroll)
                    echo "</marquee>";
            }
               
        ?>
        </font>
    </div>
        <font face="Geneva, Arial, Helvetica, sans-serif"> </font></font><font color="#66FF00" face="Geneva, Arial, Helvetica, sans-serif"><strong><em><blink>SMS INTERAKTIF</blink> </em></strong></font>

    </body>
</html>
Post Reply