473,386 Members | 1,790 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,386 software developers and data experts.

How to pass array to javascript function in php?

14
Expand|Select|Wrap|Line Numbers
  1.  if($uploadval['upload_type']==0)
  2.                         {
  3.                             $url        =    'diacomviewer.php';        
  4.                             print '<a style="cursor:pointer ;font-size:11px; font-weight:lighter; font-family:Arial;"   onclick="popitup(\'' .$url. '\',\'' .$uploadimg. '\',\''.$file_name.'\',\''.$count.'\',\''.$images[].'\')"  >View</a>';
  5.                         }
  6.                 else if($uploadval['upload_type']==2)
  7.                         {
  8.                             print '<span  style="cursor:pointer ;font-size:11px;font-weight:lighter;width:25px; font-family:Arial;"  onclick="showme(\'' .$upload_type. '\',\'' .$uploadimg. '\',\''.$file_name.'\')" >Play</span>';
  9.                         }
  10.  
In this code on popitup function i wanna pass php array to javascript function?

Please Help!!
Dec 29 '10 #1
4 2135
Dormilich
8,658 Expert Mod 8TB
what kind of PHP array, numeric or associative?
Dec 29 '10 #2
rupalee
14
associative array...
which are having contents as image name
Dec 30 '10 #3
Dormilich
8,658 Expert Mod 8TB
be aware that this does not translate into an JavaScript array (but an Object) since JavaScript does not know associative arrays. probably the easiest way in using json_encode().
Dec 30 '10 #4
rupalee
14
ok..Thanks

I will try this..

Regards,
Rupalee
Dec 30 '10 #5

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

Similar topics

1
by: Miguel | last post by:
Hello. I have a Javascript function that validates an specific form. As parameters this function receives an array of elements to be checked. Depending on the form in cause, the array could have...
1
by: Obscurr | last post by:
i've got an array created in php that I want to send over to a javascript function. onclick = "return sjekk(<?echo $names; ?> )" in my "sjekk" function, when I try to print an alert : ...
2
by: Kevin Lyons | last post by:
Hello, Can anyone assist me with what I am trying to do with the following code (six different scenarios to try to make the functionality work correctly)? I want to always (and ONLY) display...
7
by: Richard Trahan | last post by:
I need a javascript function to hex-encode a plus sign so I can pass the plus sign as an argument in a GET request. escape() and encodeURI() don't do it (and probably shouldn't, because '+' is a...
5
by: wilson | last post by:
Dear all, In this time, I want to pass array to function. What should I declare the parameter in the function?i int array or int array? Which one is correct? ...
1
by: Shapper | last post by:
Hello, I have this function: Sub MyFunction(ByVal myString As String, ByVal myArray() As String) .... End Sub And I am calling it this way: MyFunction("hello", {"ola", "hola", "hello"})
4
by: IRC | last post by:
hey, i am pretty new on javascript as well as PHP, Hey, anyone can you help me, how to pass the javascript array value to php page......... i want to retrieve the values which are arrayed on...
1
by: RuthC | last post by:
I am trying to pass a smarty array to a javascript function what is he easiest way to pass the values? I tried these code but not working. Please help me where i am wrong. <?php $url_names =...
3
realin
by: realin | last post by:
Hiya all, i am in deep trouble, i thought it was an easy task, but now its getting on my nerves. Well i have a div on a form, which contains a number of checkboxes, as <div...
9
by: nicnac | last post by:
Hi, I'm self learning javascript - so any pointers are welcomed!! I have an issue passing a form and array from one function to another. I tried many variations ! I can't get this to work...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.