If you really need a link
Just use this format:
<a href="#" onclick="document.nomeDoSeuForm.submit(); return false;">
Applying to your case:
<a href="#" onclick="document.nomeDoSeuForm.submit(); return false;"><?php
echo htmlentities( $this->idPessoa = $lotacao[$i][3] );
?></a>
Note that the htmlentities()
which I added has nothing to do with the question, but it’s good to use it to make the accent OK. If your variables are already encoded, you can remove.
If you only need the look of the link
Just use the input
normal in form, or even a button
:
<input type="submit" name="idPessoa" id="idPessoa" class="meulink"
value="<?php echo $this->idPessoa = $lotacao[$i][3];?>">
And styling with CSS:
.meulink {
display:inline;
background:transparent;
text-decoration: underline;
border: none;
cursor: pointer;
color: #00f;
}
See working on JS Fiddle
You cannot pass this information on to an Hidden input?
– rray
I tried something like this.. I placed the Hidden button, and created the <a href="javascript:Document.form.Submit();" id="person"> XXXXX </a> but it wasn’t. It works, but it’s like I caught the same ID so if I click another button of another ID will call the same previous one.
– phpricardo
Do you have several Foms? And you want the Submit input to turn into a <a href="javascript:Document.form.Submit();" id="person"> XXXXX </a> to submit this form in specific?
– Joao Paulo
It’s just a form that I have.. and three buttons that call different Ids. And I want to make them link, but they have to have a button action. (Weird kkk)
– phpricardo
Why does it have to be a link? What is the problem you have to solve? What is the result you expect from clicking on the link? What data do you need to send to the server? Sorry for all these questions. But without the answers I cannot understand what you want.
– Manuel Gerardo Pereira
Finding that bootstrap has something that already fools cool... <button type="Submit" name="idPessoa" id="idPessoa" class="Bt btn-link" style="color: red value="<? php echo $this->idPessoa = $capacity[$i][3];? >">Failed</button>
– phpricardo
@phpricardo updated the answer with a CSS solution as well.
– Bacco