-1

i need to add a text in the end of the url while user click on a button.

for example : www.example.com/people/xyz when the user click the button, it should go to www.example.com/people/xyz/edit

i did a search, & built code, but it didn't work, here it's :

$editlink = $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];

echo '<a href ="<?php $editlink;?>/edit" class="btn btn-info" role="button">EDIT</a>'

Please Help me to solve it

Kiz
  • 11
  • 3
  • you're getting a parse error but you're not letting it show you – Funk Forty Niner Apr 02 '17 at 15:23
  • You're already coding in php, why open the php brackets, and not just parse it in? `EDIT`. You should probably also turn `error_reporting()` on by adding this code at the top of your code: `error_reporting(-1)`. – Nytrix Apr 02 '17 at 15:26

1 Answers1

1

Correct your code as follows:

<?php
$editlink = $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
?>
<a href ="<?php echo $editlink;?>/edit" class="btn btn-info" role="button">EDIT</a>
Alireza Zojaji
  • 802
  • 2
  • 13
  • 33