Dynadot โ€” .com Transfer

Needed: 'Email a friend' php code with . . .

Spacemail by SpaceshipSpacemail by Spaceship
Watch

cjcjcj

Established Member
Impact
14
I need a php code like the one here:

http://www.ibdjohn.com/sendurl/

BUT I need it to automatically read the name of the page it is on so I can paste it on 40+ pages without having to manually alter the code to point the email to the URL.

Is this possible?
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable Domains โ€” AI StorefrontUnstoppable Domains โ€” AI Storefront
You could get the url of the current page with some PHP code like :

Code:
 <? echo $_SERVER['PHP_SELF']?>
And for the title of page you could try something like :
Code:
<script>
document.write(document.title);
</script>
I didn't test but it should work... Replace the value in the form with the code and test...

Hope that helps,
David.
 
0
•••
So I just take the first lot of code

<? echo $_SERVER['PHP_SELF']?>

and put it in the place where the 'URL' would go?

<!-- Change 'value' to site URL you want to be sent to the friend -->
<input type=hidden name="urlis" value="http://www.yourdomainname/yourpagename">


I don't know a lot about php so how does this work?
<input type=hidden name="urlis" value=<? echo $_SERVER['PHP_SELF']?>

Or where else does this code go ????????
 
0
•••
cjcjcj,

Like this:

<input type=hidden name="urlis" value="http://www.yourdomainname/yourpagename">

Replace the bold so it could be:

<input type=hidden name="urlis" value="<?
$page_url = 'http://www.yourdomainname.com'; // your domain name here
$page_url .= $_SERVER['PHP_SELF'];
echo $page_url;
?>">

just edit the domain name..
 
0
•••
A little confused. I wanted to get a code where I wouldn't need to enter the domain name on each page where I put the code. Instead, the code would read it from somewhere and adapt the email that is sent out to the 'friend'.

What does the above code do?
 
0
•••
Ok well, I found this premade code for you, I think it does what you look for.

<input type=hidden name="urlis" value="
<?
$_SERVER['FULL_URL'] = 'http';
if($_SERVER['HTTPS']=='on'){$_SERVER['FULL_URL'] .= 's';}
$_SERVER['FULL_URL'] .= '://';
if($_SERVER['SERVER_PORT']!='80') $_SERVER['FULL_URL'] .= $_SERVER['HTTP_HOST'].':'.$_SERVER
['SERVER_PORT'].$_SERVER['SCRIPT_NAME'];
else
$_SERVER['FULL_URL'] .= $_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];
if($_SERVER['QUERY_STRING']>' '){$_SERVER['FULL_URL'] .= '?'.$_SERVER['QUERY_STRING'];}
echo $_SERVER['FULL_URL'];
?>
">

It should output the full url in the value. Copy the code where you want to use it, and you do not need to edit anything.
 
0
•••
Looks great - I'll let you know - thanks!
 
0
•••
If I understand this correctly, you'd need to use 'mailto:[email protected]' links. But... I'm not too sure if I understand it :)
 
0
•••
Appraise.net
Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back