/    Sign up×
Community /Pin to ProfileBookmark

Place variable in href statement

Currently I have lines like this…

[CODE]<a href=”Page2011.html”></a><br />[/CODE]

I would like to write the code so that the 2011 into the variable $year.

I’m sure if this makes sense…

to post a comment
PHP

7 Comments(s)

Copy linkTweet thisAlerts:
@WolfShadeMar 27.2012 — [code=php]
$year = ( how ever you want to set the year );
$fileLink = "Page" . $year . ".html";
[/code]

<a href="[COLOR="Red"]<?php echo $fileLink; ?>[/COLOR]"></a><br />
Copy linkTweet thisAlerts:
@jeffh13_msn_comauthorMar 27.2012 — Wow it seams so simple...

$filelink = "http://www.mozilla.org/";

&lt;a href="&lt;?php echo $filelink; ?&gt;"&gt;Test&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;
I wrote this for testing... It seams to reference the page that is currently open...

Did I miss something?
Copy linkTweet thisAlerts:
@WolfShadeMar 27.2012 — When you hover the cursor over the link, what appears in the status text at the bottom of your browser?
Copy linkTweet thisAlerts:
@jeffh13_msn_comauthorMar 28.2012 — http:owblackhawkfootball.com/<?php echo $filelink; ?>
Copy linkTweet thisAlerts:
@WolfShadeMar 28.2012 — Is this code inside a .php file???? If it's doing that and not processing the code, most likely it is not inside a .php file, or the PHP server is not working.

I noticed that in the sample code you provided, you are trying to redirect to a .html file. Is this code in a .html file?
Copy linkTweet thisAlerts:
@jeffh13_msn_comauthorMar 29.2012 — Yes... WolfShade... You hit on the head... I typed it into a .php file and it works great.... Thank you....
Copy linkTweet thisAlerts:
@WolfShadeMar 30.2012 — ? I've done things like that, myself. Even after 12 years. Glad you got it working.
×

Success!

Help @jeffh13_msn_com spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...