How do you get like http://www.asdads.com/?force
to get the "force" part into something like
<a href=""force"">adad</a> so whenever I go to http://www.asasa.com/?force
the link would show as <a href="force"> ? Thank you.
PHP n00b question
Moderator: General Moderators
Code: Select all
<?php
$link = $_GET['force']; // passing along the variable from the url
echo '<a href="$link">This is a link to: $link</a>';
?>I have one more question, how do I make like http://www.blah.com/download.php?download.zip to show up as <a href="download.zip">asda</a> ? and also about that code you gave me, when I clicked on the link, it sent me to http://www.blah.com/"$link/" . I am creating a download script for my website. Thanks for your help.
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
PHP doesn't parse things in single quotes - you can try:
instead of
Mac
Code: Select all
echo '<a href="'.$link.'">This is a link to: '.$link.'</a>';Code: Select all
echo '<a href="$link">This is a link to: $link</a>';Hmm yea whoops.
I should have used double quotes instead of single. So it can be,
or
I just like the second way more because it's so much less confusing to newbies when reading the code. 
Code: Select all
<?php
echo '<a href="'.$link.'">This is a link to: '.$link.'</a>';
?>Code: Select all
<?php
echo "<a href="$link">This is a link to: $link</a>";
?>