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

Recommended Answers

All 4 Replies

Member Avatar for diafol

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.

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

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.