NameSilo

Using PHP within Javascript

Spaceship Spaceship
Watch

noswad

Established Member
Impact
1
Hi.

Is it possible to use PHP sessions within Javascript?

This is my code:

The PHP session would create a unique link ID.

PHP:
<script type="text/javascript" language="javascript" src="http://www.tkqlhce.com/placeholder-305771?SID=<?php session_start(); echo $_SESSION[user_name]; ?>&target=_top&text=%3Clink%3EClick+here+to+Join%3C%2Flink%3E&mouseover=N"></script>

Thanks for reading.
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
not directly, PHP is serverside, JS is client side. so all the output would be in the html/js code when it got the client.

but on the serverside you can mix the 2, but would suggest spliting the php code from the output (makes it easier in the long run. something like ..
PHP:
<?
session_start();
$sid = $_SESSION[user_name]; 
?>
<script type="text/javascript" language="javascript" src="http://www.tkqlhce.com/placeholder-305771?SID=<?=$sid?>&target=_top&text=%3Clink%3EClick+here+to+Join%3C%2Flink%3E&mouseover=N"></script>

noswad said:
Hi.

Is it possible to use PHP sessions within Javascript?

This is my code:

The PHP session would create a unique link ID.

PHP:
<script type="text/javascript" language="javascript" src="http://www.tkqlhce.com/placeholder-305771?SID=<?php session_start(); echo $_SESSION[user_name]; ?>&target=_top&text=%3Clink%3EClick+here+to+Join%3C%2Flink%3E&mouseover=N"></script>

Thanks for reading.
 
0
•••
Thanks for your help powerspike :hehe:
 
0
•••
Appraise.net

We're social

Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back