Ciao a tutti,
sono alcuni giorni che cerco di risolvere un problema, nella mia pagina ho questo form
<form name='formChat' id='formChat' method='post' target='_top' input type="submit">
<input name='jsenabled' type='hidden' value='1' >
<input name='smileys' type='hidden' value='1' checked='checked' >
<input name='page' type='hidden' value='chat' >
<table border="0">
<tr>
<td width="287"> <div class="testo"> Nick (obbligatorio) </div> </td>
</tr>
<tr>
<td> <input name="txtNick" id="txtNick" class='input' type="text" size="38px" > </td>
</tr>
<tr>
<td><div class="testo"> Password (opzionale) </div> </td>
</tr>
<tr>
<td> <input name="txtPass" id="txtPass" class='input' type="password" size="38px" > </td>
</tr>
<tr>
<td> <input name="chkRicordaLogin" id="chkRicordaLogin" type="checkbox" value="chkRicordaLogin" checked > Ricordami al prossimo accesso </td>
</tr>
<tr>
<td>
<table border="0">
<
<tr>
<td> <input name="imgChatS" type="submit" align="middle" onclick="ControllaCampi(1)" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('imgChatSemplice','','im ages/ChatSempliceHover.png',1)" src="images/ChatSemplice.png" width="135" height="30" border="0" id="imgChatSemplice"></td>
<td> <input name="imgChatJ" type="image" align="middle" onclick="ControllaCampi(2)" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('imgChatJava','','images/ChatJavaHover.png',1)" src="images/ChatJava.png" width="135" height="30" border="0" id="imgChatJava"></td>
</tr>
</table>
</td>
</tr>
<
</table>
</form>
la funzione controllacampi in javascript è
function ControllaCampi(n)
{
var sNick = '';
var sPass = '';
sNick = document.getElementById('txtNick').value;
sPass = document.getElementById('txtPass').value;
sNick = trim(sNick);
sPass = trim(sPass);
if (sNick == '') //Se il campo "nick" è vuoto indico di inserire un nick
{
alert("Per entrare in chat inserisci un nick.");
return false;
}
else
{
//entro qui se il campo "nick" non è vuoto
var bSalvoCookie;
bSalvoCookie = document.getElementById('chkRicordaLogin').checked ;
if (bSalvoCookie == true)
{
createCookie('CRicorda', bSalvoCookie);
createCookie('CUser', sNick);
createCookie('CPass', sPass);
}
else
{
eraseCookie('CRicorda');
eraseCookie('CUser');
eraseCookie('CPass');
}
var myForm = document.getElementById("formChat");
if (n == 1) //Chat semplice
myForm.setAttribute("action", "chats.php");
else //Chat java
myForm.setAttribute("action", "chatj.php");
myForm.submit();
return true;
}
}
il tutto sembra funzionare, ma quando si apre la pagina di destinazione in php, sembra che le variabili nel post siano vuote.
nella pagina di destinazione ho
script type="text/javascript">
//********************** Variabili globali ********************************+
var Modo_Sicuro = true;
var sNick = "<?php echo($_GET['txtNick']); ?>";
var sPass = "<?php echo($_GET['txtPass']); ?>";
var sNick = "summ";
//********************** Variabili globali ********************************+
</script>
ma il codice php non mi restituisce nulla
qualcuno saprebbe dirmi dove sbaglio??? grazie
p.s. provato su firefox 4, chrome e explorer, ma sempre con lo stesso risultato