0
votes

I have here the code for displaying the records form database..what i want is that i want to make the username a link,and when i click the link username it will open a new window..can somebody please help me with it..because i tried to search from the internet but it not working..

heres the code

 public function dataview($query)
 {

 $stmt = $this->db->prepare($query);
 $stmt->execute();

 if($stmt->rowCount()>0)
 {
 while($row=$stmt->fetch(PDO::FETCH_ASSOC)) {
 echo "<tr>";
 echo "<td> ".$row['user_id']." </td>";
 echo "<td> ".$row['username']." </td>";

 echo "<td> ".$row['password']." </td>";
 echo '<td><a style="float:left"  href="VIEWSAMPLE.PHP?user_id=' .  $row["user_id"] . '>'.$row["username"].'"<input name="image" type="image" value="edit"><image src="image/EDIT.png" class="img-responsive" width="25px"></a>
  <a style="float:left" href="delete.php?user_id=' . $row["user_id"] . '>" <input name="image" type="image" value="delete" onclick="return confirm(\'are you sure?\')"><image src="image/DELETE.png" class="img-responsive" width="25px"> </a></td>';
   echo "</tr>";
   }
 }
 else
 {
 echo "<tr>";
        "<td>Nothing here...</td>";
        "</tr>";
  }
 }
}
?>

here is the code for pop_up(this)

function pop_up(url){ window.open(url,'win2','status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=800,height=600,directories=no,location=no') }

1
What have you tried? You say "it not working" so you must have tried something. If the code you posted is your attempt, what specific problems do you have with it? "it not working" is almost certainly not enough to go off.Wai Ha Lee
@WaiHaLee itried this code echo '<td><a target="_blank" onclick="pop_up(this);" href=VIEWSAMPLE.PHP?user_id='.$row['user_id'].'>'.$row["username"].'</a></td>'; but the problem is that when i clicked the link it open a new window but at the same time it also opening a new tab..kier kier
Could that possibly be because you're using both a Javascript to pop_up a new window and target="_blank" which also pops up a new window...?!deceze♦
what should i do with it?kier kier
Why in the world have you reposted this?!deceze♦

1 Answers

1
votes

Please post the Javascript code for

pop_up(this)

If any codes written for new window under js method then remove

target="_blank"

in anchor tag.