0

Hello there, I've got a search box that finds the item that I look for but it doesn't display the id number when i put the mouse cursor on top on the item. instead of showing the id number it shows the variable ($id). Any idea why this is not working?

Here is the code that I use in the while loop:

while ($rows = mysql_fetch_assoc($rsd)){
$id = $rows['itemID'];
?>
	<div class="each_rec"><a href="item_Details.php?itemID=$id" target="_blank"><?php echo $rows['itemName'];?></a></div>
<?php
}
if($total==0){ echo '<div class="no-rec">No Record Found !</div>';}?>

when I put the cursor over the link it display this:

http://localhost/item_Details.php?itemID=$id

instead of

http://localhost/item_Details.php?itemID=7

Thanks

3
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by junior_rosul
0

You've included php variable in plain html.

<div class="each_rec"><a href="item_Details.php?itemID=<?php echo $id;?>" target="_blank"><?php echo $rows['itemName'];?></a></div>

should work.

0

yes! brilliant, it works!
I should have thought about it!
Thank you so much.

0

i hava the same problem.... but in mine is not working... here is the code:

function lista_filiais(){
        include("conectar.php");
        $consulta="
            SELECT
                id, 
                nome, 
                endereco, 
                telefone
            FROM
                FILIAL
        ";

        echo "  <tr>";
        echo "      <td>id</td>";
        echo "      <td>nome</td>";
        echo "      <td>endere├žo</td>";
        echo "      <td>telefone</td>";
        echo "  </tr>";

        $query = mysql_query($consulta)or die($consulta.": ERRO AO SELECIONAR FILIAIS: ".mysql_error());
        while($row = mysql_fetch_array($query)){
            echo "  <tr>";
            echo "      <td><a href='exibir_usuarios_filial.php?filial='".$row['id']."'>".$row['id']."</a></td>";
            echo "      <td><a href='exibir_usuarios_filial.php?filial='".$row['id']."'>".$row['nome']."</a></td>";
            echo "      <td><a href='exibir_usuarios_filial.php?filial='".$row['id']."'>".$row['endereco']."</a></td>";
            echo "      <td><a href='exibir_usuarios_filial.php?filial='".$row['id']."'>".$row['telefone']."</a></td>";
            echo "  </tr>";
        }
        mysql_free_result($query);
        mysql_close($conexao);
    }

the link is like this: http://127.0.0.1:8080/chamados/exibir_usuarios_filial.php?filial=
when its to be like that: http://127.0.0.1:8080/chamados/exibir_usuarios_filial.php?filial=1

0

i found th problen... its in

echo " <td><a href='exibir_usuarios_filial.php?filial='".$row['id']."'>".$row['id']."</a></td>";

its open href=' and than its open filial=' but is only closed filial.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.