Getting part of a link to display in page
Moderator: General Moderators
Getting part of a link to display in page
I was wondering if there was a way to show text in the URL on the page. Here's an example. Let's say I have a link like this: 'http://perks.mypimpedlayout.com/profile ... persons_sn'. How would I display 'persons_sn' on the page. Help is much appreciated. Thanks in advance.
- blacksnday
- Forum Contributor
- Posts: 252
- Joined: Sat Jul 30, 2005 6:11 am
- Location: bfe Ohio :(
Code: Select all
echo $_GET['screenname'];index.php?screenname=me&yourname=you
$_GET[screenname]
would output: me
$_GET[yourname]
would output: you
cheers
Last edited by blacksnday on Thu Jun 15, 2006 2:56 pm, edited 1 time in total.
Code: Select all
echo $_GET['screenname'];- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Here's the code I'm using:
But the problem is I need to have a line break after every screenname that get's put in the file. Any help?
Code: Select all
<?php
$filename = 'visitors.txt';
$screenname = $_GET ['screenname'];
if (is_writable($filename)) {
if (!$handle = fopen($filename, 'a')) {
echo "Cannot open file ($filename)";
exit;
}
if (fwrite($handle, $screenname) === FALSE) {
echo "Cannot write to file ($filename)";
exit;
}
echo "Success, wrote ($screenname) to file ($filename)";
fclose($handle);
} else {
echo "The file $filename is not writable";
}
?>