473,383 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Use PHP in Javascript

Hi,

I know it's not smart to use php and javascript together, but i need it. So I would like to know if this is possible.

This is my php code, I'm reading out my database.

[PHP]
<?php foreach ($listRows as $record): ?>
<?php $link1 = $record['link1'];
$link2 = $record['link2'] ;
$link3 = $record['link3'] ;
$link4 = $record['link5'] ;
$link5 = $record['link6'] ;
$link6 = $record['link7']; ?>

<?php endforeach ?>
[/PHP]

Now I need my $link vars in a javascript.
Is This possible??
Help would be very much appriciated
Feb 21 '08 #1
2 2126
Markus
6,050 Expert 4TB
Hi,

I know it's not smart to use php and javascript together, but i need it. So I would like to know if this is possible.

This is my php code, I'm reading out my database.

Expand|Select|Wrap|Line Numbers
  1.     <?php foreach ($listRows as $record): ?>
  2. <?php $link1 = $record['link1'];
  3.             $link2 = $record['link2'] ;
  4.             $link3 = $record['link3'] ;
  5.             $link4 = $record['link5'] ;
  6.             $link5 = $record['link6'] ;
  7.             $link6 = $record['link7']; ?>
  8.  
  9.     <?php endforeach ?>
  10.  
Now I need my $link vars in a javascript.
Is This possible??
Help would be very much appriciated
Can you show a written code, of javascript, on how you would like the outcome to look.
cheers :)
Feb 21 '08 #2
This is my javascript.

Expand|Select|Wrap|Line Numbers
  1. <script language="javascript">
  2. <!-- 
  3.  
  4.  stBM(2,"tree1d1a",[0,"","","blank.gif",0,"left","default","hand",0,0,-1,-1,-1,"none",0,"#000000","transparent","","repeat",1,"defButton_f%20.gif","defButton_uf.gif",9,9,1,"line_def0.gif","line_def1.gif","line_def2.gif","line_def3.gif",1,0,3,1,"center",0,0]);
  5. stBS("p0",[0,0]);
  6. stIT("p0i0",["Snel naar","","_self","","","defIcon_f.gif","defIcon_uf.gif",18,18,"9pt 'Arial'","#000000","none","transparent","","no-repeat","9pt 'Arial'","#000000","underline","transparent","","no-repeat","9pt 'Arial'","#FFFFFF","none","#000099","","no-repeat","9pt 'Arial'","#FFFFFF","underline","#000099","","no-repeat",0,0,"left","middle",0,0]);
  7. stBS("p1",[,1],"p0");
  8. stIT("p1i0",[$link1],"p0i0");
  9. stBS("p2",[],"p0");
  10. stIT("p2i0",["Netwerken",,,,,"defIcon_c.gif","defIcon_c.gif"],"p0i0");
  11. stIT("p2i1",["Servers"],"p2i0");
  12. stES();
  13. stIT("p1i1",[$link2],"p2i0");
  14. stIT("p1i2",[$link3],"p2i0");
  15. stIT("p1i3",[$link4],"p2i0");
  16. stIT("p1i4",[$link5],"p2i0");
  17. stIT("p1i5",[$link6],"p2i0");
  18. stES();
  19. stES();
  20. stEM();
  21. //-->
  22. </script>
  23.  
I use it to make a tree structure (like windows) but I want the topics to be the one's from my database.

$link obvisualy has to be replaced by the javascript var :)
Feb 21 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.