Hi: I know very little about PHP, but do know code (actionscript, javascript, ColdFusion).
I'm trying to get the name of a file and send it to myself if someone clicks it. Right now, I'm using a little PHP script to capture the browser type and put that in a message using the mail commands.
What call would I use to get the name of the page clicked? And how do I concatenate that information into the body of my message? How do I concatnate other variables I have access to into the message body variable?
Thanks in advance for any help or suggestions.
Doug Bonneville
http://www.bonfx.com
capture filename and email it: help
Moderator: General Moderators
-
dbonneville
- Forum Newbie
- Posts: 2
- Joined: Wed Jan 15, 2003 9:56 am
$_SERVER['PHP_SELF'] contains the name of the current script (as virtual path), in older versions or with register_globals=On it's stored in $PHP_SELF.
String concatenation is done viahttp://www.php.net/manual/en/reserved.variables.php
http://www.php.net/manual/en/language.operators.string.php
String concatenation is done via
Code: Select all
$result = $string1 . ' <-> '.$string2;http://www.php.net/manual/en/language.operators.string.php
-
dbonneville
- Forum Newbie
- Posts: 2
- Joined: Wed Jan 15, 2003 9:56 am
Is '<->' the concatentation call? If I want to put a few string items together into one var and dump that into the body of the email, would that be:
$myMailMessage = $first.'<->'.$second.'<->'$third;
Do I need spaces after the string name before the period, and also after the period but before the $ of the next var name?
Thanks!
Doug
$myMailMessage = $first.'<->'.$second.'<->'$third;
Do I need spaces after the string name before the period, and also after the period but before the $ of the next var name?
Thanks!
Doug
-
laserlight
- Forum Commoner
- Posts: 28
- Joined: Wed Jan 01, 2003 6:41 am
the concatenation uses the dot operator, as in
The '<->' is string some string separator so you can differentiate the original strings when they are stored as a single string.
Code: Select all
$str1 = $str2 . $str3;sorry, I just wanted to show that it doesn't matter wether you concatenate variables or literalsYou may concatenate almost any type (because almost any type has a string representation ... a more or less reasonable
)
p.s.: a more or less reasonable string representation means e.g.which will print Array because the string representation of any array is Array
Code: Select all
$s1 = 'string concatenation';
$s2 = 'easy';
$out = $s1 . ' is ' . $s2;
echo $out;Code: Select all
$a = 1;
$b = 2;
$out = $a . '+' . $b . '=' . ($a+$b);
echo $out;p.s.: a more or less reasonable string representation means e.g.
Code: Select all
$arr = array(1,2,3,4);
echo $arr;