lo que quieres hacer lo tienes que hacer con ajax, dado que el elemento algo toma valor sólo en tiempo de ejecución cuando se activa el evento, es decir, en el navegador del cliente y no en el servidor, luego necesitas hacer que una vez que se active el evento se haga un llamado al servidor y que este responda.
Prueba con esto:
Código Javascript
:
Ver originalfunction newAjax() {
var xmlhttp = false;
try {
xmlhttp = new ActiveXObject('Msxml2.XMLHTTP');
} catch(e) {
try {
xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
} catch(E) {
if(!xmlhttp && typeof XMLHttpRequest != 'undefined') {
xmlhttp = new XMLHttpRequest();
}
}
}
return xmlhttp;
}
function clic(algo){
var variableJscript;
var ajax = newAjax();
ajax.open('GET', 'generateVal.php?algo='+algo, true);
ajax.onreadystatechange = function() {
if (ajax.readyState == 4) {
alert('llamada a funcion Php desde Javascript : ' + ajax.responseText);
}
}
ajax.send();
}
y en generateVal.php
Código PHP:
Ver original<?php
$algo = $_GET['algo'];
include_once 'prueba.php';
$obj = new prueba();
echo $obj->respuesta($algo);
?>
Espero te ayude
Saludos