What i am creating is a dynamic html page
If i create the javascript array within the head of my php page will i be able to acess this array through my js functions?
Search found 19 matches
- Wed Dec 16, 2009 12:49 pm
- Forum: PHP - Code
- Topic: Converting php array to javascript array
- Replies: 5
- Views: 203
- Wed Dec 16, 2009 12:33 pm
- Forum: PHP - Code
- Topic: Converting php array to javascript array
- Replies: 5
- Views: 203
Re: Converting php array to javascript array
Thanks, I have never implemented this before.
Am i stupid in asking this, I am required to do this in the head section...
As this code goes in the head will it still work if the php array declaration is in the body. Does this mean i need to create a function?
Am i stupid in asking this, I am required to do this in the head section...
As this code goes in the head will it still work if the php array declaration is in the body. Does this mean i need to create a function?
- Wed Dec 16, 2009 11:49 am
- Forum: PHP - Code
- Topic: Converting php array to javascript array
- Replies: 5
- Views: 203
Re: Converting php array to javascript array
Json_encode()
Just read up on it, it says that it returns a string on execution.
I want to return a populated array, do you mean to say populate the javascript array with json_encode() ?
My experiance in both javascript and php are limited sorry
Just read up on it, it says that it returns a string on execution.
I want to return a populated array, do you mean to say populate the javascript array with json_encode() ?
My experiance in both javascript and php are limited sorry
- Wed Dec 16, 2009 11:39 am
- Forum: PHP - Code
- Topic: Converting php array to javascript array
- Replies: 5
- Views: 203
Converting php array to javascript array
Hi, I want to create a javascript array that duplicates the values within a PHP array. I have looked at many resources online, but due to little understanding i havent implemented them as of yet. What i am asked to do is duplicate this php array to a javascript array within the head of my php page. ...
- Tue Dec 15, 2009 5:12 pm
- Forum: PHP - Code
- Topic: Help please
- Replies: 1
- Views: 60
Re: Help please
CSS /* Set style rules to control the appearance of the major tags e.g. <body> <p> <h#> <hr> <table> <td> <div>. Make use of inheritance e.g. setting the font-family in the <body> tag will be inherited by other tags. Make relevant changes to other tags where you wish the font or text appea...
- Tue Dec 15, 2009 5:11 pm
- Forum: PHP - Code
- Topic: Help please
- Replies: 1
- Views: 60
Help please
I have been running my php locally with XAMPP. When i uploaded my file onto the server it wouldnt act like it did when i was running it locally What i want to do is display a table with values from an array showing within the table if the post value is correctly posted. I just want to know whether o...
- Sat Dec 12, 2009 5:50 pm
- Forum: PHP - Code
- Topic: Associative arrays
- Replies: 12
- Views: 1096
Re: Associative arrays
Thanks for that print code
I realised that my problem was because that some keys were identicle which caused a problem but i have now rectified it. Thank you you have saved me time, stress, among other things haha
I realised that my problem was because that some keys were identicle which caused a problem but i have now rectified it. Thank you you have saved me time, stress, among other things haha
- Sat Dec 12, 2009 3:33 pm
- Forum: PHP - Code
- Topic: Associative arrays
- Replies: 12
- Views: 1096
Re: Associative arrays
The code did work up untill the last 2 keys... any suggestions? Heres the array... $module_name['CM2013'] = "Professional Development in Computing"; $module_name['CM3004'] = "Systems Development"; $module_name['CM3006'] = "Internet Based Programming"; $module_name['CM30...
- Sat Dec 12, 2009 2:54 pm
- Forum: PHP - Code
- Topic: Associative arrays
- Replies: 12
- Views: 1096
Re: Associative arrays
Thank you very much man, Your a star!
- Sat Dec 12, 2009 2:41 pm
- Forum: PHP - Code
- Topic: Associative arrays
- Replies: 12
- Views: 1096
Re: Associative arrays
Not really got far with this if you could help me out with code that assigns the values to an array rather than the $key variable i would be very gratefull
- Sat Dec 12, 2009 2:28 pm
- Forum: PHP - Code
- Topic: Associative arrays
- Replies: 12
- Views: 1096
Re: Associative arrays
Ok sorry, In your code you assign all the keys to a variable.
Well what i would really want to do is assign the keys to an array so i can access each key individually.
Im trying to break up your code to try implement it in array form as we speak
Well what i would really want to do is assign the keys to an array so i can access each key individually.
Im trying to break up your code to try implement it in array form as we speak
- Sat Dec 12, 2009 1:52 pm
- Forum: PHP - Code
- Topic: Associative arrays
- Replies: 12
- Views: 1096
Re: Associative arrays
What about if i want to access them singularly?
i have to populate my table with the keys, 1 key per table cell
i have to populate my table with the keys, 1 key per table cell
- Sat Dec 12, 2009 12:17 pm
- Forum: PHP - Code
- Topic: Associative arrays
- Replies: 12
- Views: 1096
Re: Associative arrays
Ok, i know how to display the array elements
But what i want to know is how to actually display the key, such as 'CM2013'
Whats wrong with the way i have declared my arrays?
It states in w3schools site this is the correct way?...
But what i want to know is how to actually display the key, such as 'CM2013'
Whats wrong with the way i have declared my arrays?
It states in w3schools site this is the correct way?...
- Sat Dec 12, 2009 11:41 am
- Forum: PHP - Code
- Topic: Associative arrays
- Replies: 12
- Views: 1096
Associative arrays
Hi I have made up an associative array, what i want to do is display the array key Here is my array. So i will display CM2013.. any ideas? I looked at the key function but this must need to be incremented or something as i can only get the first key displayed. $module_name['CM2013'] = "Profes...
- Sat Dec 12, 2009 11:37 am
- Forum: PHP - Code
- Topic: Tables in PHP
- Replies: 3
- Views: 155
Re: Tables in PHP
I got this fixed, all i needed to do was open my php tags end the if bracket and close php tag again
Fairly simple thing but with my very little development knowledge it wasnt that simple haha
Hope this helps anyone with the same problem
Fairly simple thing but with my very little development knowledge it wasnt that simple haha
Hope this helps anyone with the same problem