Jump to content

Passing array values in a link


mmarif4u

Recommended Posts

Hi guys...

I am facing a simple prob.

I have a CMS where i have a page where i retrieve data from mysql...

That is done, but the prob is i put three links for every product, one is activate, de-activate and delete

But now i want to remove these links and just put a checkbox where i select 5 items. I have a to put

links or button one will be activate and de-activate and delete.

When clicked one of that it will redirect to another page where the process will take place.

I have some sort of code but i am not sure how to do with single activate, de-activate etc link or button

when certain checkboxes selected, to pass the ids of that select items to another page.

I know that i have to use array i tried but no luck.

The code  which i have so far:

 

while($row = mysql_fetch_object($result_list)) {
                
                echo "<tr>";
                echo "<td> $num </td>";
                echo "<td> $row->id</td>";
                echo "<td> <a href='display_music_dtl.php?id=$row->id'>$row->description</a></td>";
                echo "<td> $row->artist</a></td>";
                echo "<td align=center>$row->active</td>";
                echo "<td align=center>$row->date</td>";
                if($row->active=='X'){
                echo "<td align=center><a href='inactive.php?id=$row->id&action=a'>D</a></td>";
                }else {echo "<td>&nbsp</td>";
                }                
                if($row->active=='X'){
                echo "<td>&nbsp</td>";
                }else{
                echo "<td align=center><a href='activate.php?id=$row->id&action=a'>A</a></td>";
                 }
                echo "<td align=center><a href='delete.php?id=$row->id&action=a'>Del</a></td>";
                echo "<td align=center><a href='edit_music_dtl.php?id=$row->id'>Edit</a></td>";
                echo "<td align='center' bgcolor='#FFFFFF'><input name='checkbox[]' type='checkbox' id='checkbox[]' value='<? echo $row->id; ?>'></td>";
               
                echo "</tr>";
                $num++;
          } 

 

 

The code in another page to do trick...

for($i=0;$i<$count;$i++){

$del_id = $checkbox[$i];
$sql="update header_logo set active='X' where id ='$del_id'";
$query=mysql_query($sql);
header('location:activated_msg.php');
exit;

 

can some give a little idea how to pass array values in a link to another page.

And a selected action is selected for example activate or de-activate etc..

Thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/64369-passing-array-values-in-a-link/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.