Joshua Adams
Joshua Adams

Reputation: 39

Insert PHP variable in external link

The link works perfectly fine internally on the domain, just won't work for an external website. Didn't see anything in the documentation. I provided an example below. Would appreciate some insight.

<?php $user = basename($_SERVER['PHP_SELF']);?>

<a href="https://www.externaldomain.com/secure/cart/addItem.aspx?qty=1&itID=9135&PromoID=83&uid=<?php echo $user->username ?>">

Upvotes: 0

Views: 95

Answers (1)

Berriel
Berriel

Reputation: 13601

Based on you comment, you must have a page url like page.php?ID=userid and you want something like this: {externalpage.com/page.php}?uid=userid

Try:

<a href="https://www.externaldomain.com/secure/cart/addItem.aspx?qty=1&itID=9135&PromoID=83&uid=<?php echo $_GET["ID"]; ?>">

Edit

Based on your last comment, try this:

<?php $user = basename($_SERVER['PHP_SELF']);?>
<a href="https://www.externaldomain.com/secure/cart/addItem.aspx?qty=1&itID=9135&PromoID=83&uid=<?php echo $user; ?>">

Upvotes: 1

Related Questions