[advanced search]
Results from the most recent live auction are here.
18 members in the live chat room. Join Chat!
Register Rules & FAQ NP$ Store Active Threads Mark Forums Read
Go Back   NamePros.Com > Design and Development > Programming > CODE
User Name
Password

Old 02-10-2004, 06:26 PM   · #1
Crusader
Alert Status Red
 
Crusader's Avatar
 
Name: Anton
Location: Canada
Trader Rating: (24)
Join Date: Aug 2003
Posts: 1,284
NP$: 1252.00 (Donate)
Crusader is just really niceCrusader is just really niceCrusader is just really niceCrusader is just really nice
insert php code into javascript

I've made a javascript and would like to know how to echo a value into the script.

Code:
iView.document.body.innerHTML = '<? echo $source; ?>';


that just pastes it as "<? echo $source; ?>".

Any ideas?


Please register or log-in into NamePros to hide ads
__________________

Near Fantastica
| Matthew Good - Hospital Music
>> Do you Frawlik? <<
Crusader is offline   Reply With Quote
Old 02-13-2004, 04:23 PM   · #2
deadserious
Senior Member
 
Trader Rating: (13)
Join Date: Aug 2002
Posts: 1,300
NP$: 2.85 (Donate)
deadserious has a spectacular aura aboutdeadserious has a spectacular aura about
That should work if $source has a value. It should replace $source with whatever it's value is.

So if you had something like:

PHP Code:
<?
$source
= "YourValue";
?>

iView.document.body.innerHTML = '<? echo $source; ?>';


The result should be:
Code:
iView.document.body.innerHTML = 'YourValue';


You can also do it as <?=$source?> for a little shortcut.

If it's just printing out <? echo $source; ?> then you may not have the short_open_tag enabled.
deadserious is offline   Reply With Quote
Old 02-18-2004, 08:23 AM   · #3
Crusader
Alert Status Red
 
Crusader's Avatar
 
Name: Anton
Location: Canada
Trader Rating: (24)
Join Date: Aug 2003
Posts: 1,284
NP$: 1252.00 (Donate)
Crusader is just really niceCrusader is just really niceCrusader is just really niceCrusader is just really nice
source did have a value...
i registered it as a session too.
__________________

Near Fantastica
| Matthew Good - Hospital Music
>> Do you Frawlik? <<
Crusader is offline   Reply With Quote
Old 02-20-2004, 12:53 PM   · #4
deadserious
Senior Member
 
Trader Rating: (13)
Join Date: Aug 2002
Posts: 1,300
NP$: 2.85 (Donate)
deadserious has a spectacular aura aboutdeadserious has a spectacular aura about
Well like I mentioned above maybe your short_open_tag isn't enabled or something if you're sure their was a value in the variable. It could also be a problem with register_globals or the way you're assigning the value or something like that. Otherwise it would print it to the browser just like you expect. I would need to see how you're getting the values and such to see what's really going on.
deadserious is offline   Reply With Quote
Closed Thread

NamePros is a revenue sharing forum.

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


Site Sponsors
Hunting Moon Click to Watch Instant Video Traffic Down Under
Advertise your business at NamePros
All times are GMT -7. The time now is 05:15 PM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0