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? Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.