php - Is it proper form to use an image for a button tag within a form tag

987

as way of background, i have no formal education. i take online courses and am learning this stuff at my own pace with my limited skill set, so i apologize if i'm getting this stuff wrong.

project wise, i have a webpage that will have three buttons on it, using images of the affiliations for the game i'm playing as the buttons. i want the user (me) to click on the affiliation of my choice, and send that affiliation to the next page via "GET". i will use the "GET" affiliation on the next page as a variable to access the correct table in my mysql database to do whatever that page does - add a new entry, pull an index of all the pilots and ships, etc.

is it improper form to do the following (sorry, don't have access to code right now):

oops...dont know how to add code in here. the idea is to have a form with a method of "get". the next child would be to have a submit button with the name of "affiliation" and each button would have its own unique value (which will be used on the next page to determine which table to access). the last child would be an img tag of the image i want to use as the button. is that proper structure?

it does what i want it to do (tested it this morning), but at the same time i am doing this project to learn, so i want to also learn how to do things the right way. if it is proper, i will then have to learn how to make the hover-over of the button act like a hyperlink so a user knows to click on the button.

Thanks in advance. SO is a great source of ideas and it has helped me a lot during the creation of my project.

<form action="add_pilot_form.php" >
<div >
  <div >
    <button type="submit"  name="affiliation" value="A"> 
    <img src="../img/A-alliance.png" alt="">
    </button>
  </div>
  <div >
    <button type="submit"  name="affiliation" value="B">
    <img src="../img/B-alliance.png" alt="">
    </button>
  </div>
  <div >
    <button type="submit"  name="affiliation" value="C">
    <img src="../img/C-alliance.png" alt="">
    </button>
  </div>
</div>

People are also looking for solutions to the problem: codeigniter - PHP Reading string as exponential number

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.