filipelou Posted August 28, 2007 Share Posted August 28, 2007 <a href="novidades.php?id=" onclick=" if(XXXX) this.href+=document.getElementById('dominio').value;else alert('SubDominio não encontrado!!')">Ver Novidades</a> where is xxxxx i want this function on external php function mostra_idDominio($nomeDominio){ ligarDB(); $query="select id from subdominios where nomeSub='$nomeDominio'"; $resultado=mysql_query($query); $row = mysql_fetch_assoc($resultado); $num=mysql_numrows($resultado); if ($num>0){ return ($row['id']); } else{ return -1; } desligarDB(); } to that i have to pass document.getElementbyId('Dominio').value and check if it is !=-1. How to do that? Link to comment https://forums.phpfreaks.com/topic/67046-returning-value-on-php-function-and-pass-javascript-parameter/ Share on other sites More sharing options...
mainewoods Posted August 28, 2007 Share Posted August 28, 2007 the ways to get a value from javascript to php are: 1) submit a form - reloads page 2) call a link with url passed parameters - reloads page 3) use ajax - does not reload page but requires the most coding Link to comment https://forums.phpfreaks.com/topic/67046-returning-value-on-php-function-and-pass-javascript-parameter/#findComment-336364 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.