php - Multiple buttons and 'a' tags that post from a single page


I have multiple buttons and a tags that are submitted from a single view. The 'a' tag submits using javascript. I want to use the same method, one form post, but I want to check which button or 'a' tag is set. I don't know how to do that?

if (isset($_POST['a_tag_name'])) {
  //data table 1
  //different data from table 2
} //calling buttons
elseif (isset($_POST['en'])) {
  $language = 'en';
} elseif (isset($_POST['sq'])) {
  $language = 'sq';
} elseif (isset($_POST['tr'])) {
  $language = 'tr';
<a id="slider-content-link" onclick="javascript:getimageid('{{$row->id}}')" id="view_post">
  <h3 >
    <p align="right">{{$row->title}}</p>



Make your "buttons" be actually "submit buttons".

Only the submit button you click will be passed as parameter in the post. Then just check which of all the submit is passed, and there you have it.

People are also looking for solutions to the problem: php - Website not displaying images


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.