Reputation: 147
i need to concatenate this variable $idCantiere
into a href attribute
<a class="btn btn-primary" href="../../../paginaIniziale/sceltaModificaAffidatario.php?idCantiere='.$idCantiere.'">Continua -></a> `
In other words, I need that when I press the "Continua->"
button, I will be redirected to the HREF page but with the addition, at the end of the link, of the "idCantiere"
Upvotes: 1
Views: 3042
Reputation: 36680
Try the following:
<a class="btn btn-primary" href="../../../paginaIniziale/sceltaModificaAffidatario.php?idCantiere=<?php echo $idCantiere ?>Continua -></a>
What this does is the following:
<?php
tags so we can write php. ?>
When you use echo
in php it will output the value of a variable to the actual HTML file that will be produced. Thus you use echo when you need to output something dynamic into the html.
Upvotes: 6
Reputation: 31
Here are two possible solutions:
https://www.tehplayground.com/rpPcUnram5TAxdAs
Have fun!
edit: sorry for that here is the code:
No 1:
<?php
$idCantiere = 123;
print '<a class="btn btn-primary" href="../../../paginaIniziale/sceltaModificaAffidatario.php?idCantiere='.$idCantiere.'">Continua -></a>';
?>
No 2:
<?php
$idCantiere = 123;
?>
....
<a class="btn btn-primary" href="../../../paginaIniziale/sceltaModificaAffidatario.php?idCantiere=<?php print $idCantiere; ?>">Continua -></a>
Upvotes: 0