modifying client side elements from server side php
Posted: Sun May 11, 2008 12:40 pm
Hi, I am fairly new to php, javascript and html, but I have got a lot of stuff working by looking at other people examples and extrapolating from that.
I have created a number of html pages (by help of a design editor) and would just like to add php-serverside code to retrieve some data and perform some logic. I am almost there...
What I cannot get working is having my server side php code modify some elements from the caller html page.
In javascript I can use getElementById and then change innerHTML.
In my php function I can't seem to make that work.
In the writeup below I would like the element "thiselement" to have the text "goodbuy" when the link is clicked on.
HTML:
...
<a id=thiselement>hallo</a>
..
<a href=..function.php>call php</a>
and in another file:
function.php:
...
function modElement() {
$el= $doc.getElementById('thiselement');
$el.innerHTML ='goodbuy';
}
The design is probably all wrong as I have tried imitating javascript, but could someone please advice me how to do this properly. And if possible not refer to ajax or another programming environment, it should be possible within plain old php right?
Thanks in advance
I have created a number of html pages (by help of a design editor) and would just like to add php-serverside code to retrieve some data and perform some logic. I am almost there...
What I cannot get working is having my server side php code modify some elements from the caller html page.
In javascript I can use getElementById and then change innerHTML.
In my php function I can't seem to make that work.
In the writeup below I would like the element "thiselement" to have the text "goodbuy" when the link is clicked on.
HTML:
...
<a id=thiselement>hallo</a>
..
<a href=..function.php>call php</a>
and in another file:
function.php:
...
function modElement() {
$el= $doc.getElementById('thiselement');
$el.innerHTML ='goodbuy';
}
The design is probably all wrong as I have tried imitating javascript, but could someone please advice me how to do this properly. And if possible not refer to ajax or another programming environment, it should be possible within plain old php right?
Thanks in advance