0

I am having difficulty to find out correct quote patterns to inside href to write PHP code. I checked other StackOverflow questions but did not get any idea. I am displaying data in PHP using table written inside PHP code rather then in HTML. Can anyone help me please? Thanks

"<td><a href='reps.php?id=<?php echo $data['userID']?>'". $data["userID"]. "</a></td></tr>";
user3718511
  • 317
  • 1
  • 3
  • 15
  • 1
    You do not "open" PHP again, you are already in a PHP block. Use the `.` operator to concat strings and variables. – Progman Nov 30 '21 at 18:36
  • @Progman Following your advice will lead to [cross-site scripting](https://en.wikipedia.org/wiki/Cross-site_scripting). It's the wrong approach. – Roland Illig Nov 30 '21 at 18:38
  • @Progman Thanks for your help. just one question the line is already echo but I am not displaying id in URL its just showing empty. and if I add echo then its giving me an error. – user3718511 Nov 30 '21 at 18:49
  • perhaps something like this: ; -- you are using double quotes " before your html? no need.... also you didn't close your php with ;?> see my example – Shlomtzion Nov 30 '21 at 19:16

0 Answers0