This is my functional onClick script in HTML and it works perfectly:
<input type="text" id="t" name="t" value="1">
<a href="testar.php?action=" onclick="window.location=this.href+'&quant='+document.getElementById('t').value;return false;">Click</a>
What i want to achieve is this:
echo '<input type="text" value="1" id="t" name=""/>
<a href="addCarrinho.php?id_produto='.$registo['id'].'&nome='.$registo['nome'].'&preco='.$registo['preco'].'" onclick="window.location=this.href+'&quant='+document.getElementById('t').value;return false;">Add</a>';
All php works, i am receiving php variables on the other page but the onClick javaScript is not working, im getting a sintaxe error. I think its a quotes problem but im not familiarized with javaScript.