Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8947031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:39:00+00:00 2026-06-15T12:39:00+00:00

I want to make a picture send a specific value tied to that image

  • 0

I want to make a picture send a specific value tied to that image when clicked to a php file that will make a mySQL query.

For example let say I have a HTML page of animal pictures that when a specific animal image is clicked, say an image of a Cat, it would sent that as a value to be assigned to a variable that is then put into a MySQL query that will pull out different breeds of cats from an animal database containing cats,dogs, horses, ect.

So in the HTML page, animals.html, I am creating the images with this code:

//animals.html
<form action="animalQuery.php" method="get"> <input type="image" src="Cat.jpg" name="cats" width="350" height="225">
<form action="animalQuery.php" method="get"> <input type="image" src="Dog.jpg" name="dogs" width="350" height="225">

When the Cat.jpg image is clicked I want to send the value “cats” to be assigned to $animal variable so that it basically makes the $stmt below equate to “select * from Animals where breeds = ‘cats’;” which is a working Query.

//animalQuery.php
$animal=$_GET["cats"]; 
$stmt="select * from Animals where breeds =  $animal;";

It works if I hard code the $stmt with value of “cats” or “dogs” in place of the variable $animal, so I know the Query works. I am just having trouble figuring out how to have the image when clicked send the specific value I want to that variable $animal. Once I figure that out I should be able to figure out how to have the single variable $animal get set to a certain value when one of the many images is clicked so that one variable works for all the images.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T12:39:01+00:00Added an answer on June 15, 2026 at 12:39 pm

    Why a full-blown form for something so simple?

    <a href="animalQuery.php?animal=cat"><img src="..." /></a>
    <a href="animalQuery.php?animal=dog"><img src="..." /></a>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello I want to make an app that post a specific picture to users
I have an picture (file type is png) and I want to make this
I have a picture that I want to make it so that when you
I want to make an ajax call in jquery which will bring a picture
I want to make a simple image viewing program, that just takes the images
I want to display a picture near a LinearLayout . I want to make
I have link for example domain.com/de/controler/action?param=value and I want make actionlink to keep same
I want to make a puzzle game in XNA where I take a picture
I want to make user upload his picture. After he selects the picture from
I want to make a picture gallery with a vertical layout with two parts:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.