Jump to content

remove image link after selection is made from jquery autocomplete


frshjb373

Recommended Posts

I am using the search query below to populate my jquery auto complete.  The image shows up great in the search, but when I select an item from my search, it populates the text box with the href code as well. For example:

<img src="images/catalog-images/1211767440.png" width="100" >Apple iPhone 4S - 32GB

 

Just trying to figure out how to remove the image link after item is selected.  Any help is much appreciated.  Thank you in advance!

 

<?php
    $q=$_GET['q'];
$my_data = str_replace(array("'", '"'), array("", ""), $q);
    //$my_data=mysql_real_escape_string($q);
    $mysqli=mysqli_connect($DB_host,$DB_user,$DB_pass,$DB_name) or die("Database Error");
    $sql="SELECT * FROM cell_brands WHERE name LIKE '%$my_data%' OR keyword1 LIKE '%$my_data%' OR keyword2 LIKE '%$my_data%'";
    $result = mysqli_query($mysqli,$sql) or die(mysqli_error());


    if($result)
    {
        while($row=mysqli_fetch_array($result))
        {
		echo "<img src=\"images/catalog-images/" . $row["photo-image"] . "\" width=\"100\" >";
            echo $row['name']."\n";
        }
    }
//mysql_close($mysqli);
?>

I've attached images for you.  If the image is echoed it is seen in the autocomplete dropdown when searched, but when you actually select it, the img code is also shown in the text field.  I'd like to find a way to remove that image code after an item is selected so all the user sees is the item name.  Does that make sense?

post-132390-13482403767512_thumb.png

post-132390-13482403768098_thumb.png

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.