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);
?>

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.