0

I'm trying to use a php variable to add a href value for a link in an echo statement.

Here's a simplified version of the code I want to use. I know that I can't just add the variable into the echo statement, but I can't seem to find an example anywhere that works.

<a href="<?=base_index();?>list-job-order?<?=$param;?>" class="btn btn-success btn-flat"><i class="fa fa-step-backward"></i> Back</a>
Qirel
  • 25,449
  • 7
  • 45
  • 62
Fikfattt
  • 448
  • 2
  • 12

1 Answers1

0

this code will work. kindly use this code in your .php file.

<a href="<?php echo base_index();?>list-job-order?<?php echo $param;?>" class="btn btn-success btn-flat"><i class="fa fa-step-backward"></i> Back</a>

and if you want to echo in then use this

<?php
echo "<a href=" . base_index() . "list-job-order?" . $param . " class='btn btn-success btn-flat'><i class='fa fa-step-backward'></i> Back</a>";

 ?>