PHP and JS
Posted: Tue Oct 13, 2009 9:37 am
I have a textbox on my html site that is named q. I want it that when people click on this link it will put the text of that link into the box.
This works:
<a href='#' onclick="javascript: document.getElementById('q').value = 'test';"><?php echo $firstName;?></a>
it puts the word test into the box named q
But this doesnt:
<a href='#' onclick="javascript: document.getElementById('q').value = '<?php echo $firstName;?>';"><?php echo $firstName;?></a>
Might anyone know why?
Thanks in advance
Rob
This works:
<a href='#' onclick="javascript: document.getElementById('q').value = 'test';"><?php echo $firstName;?></a>
it puts the word test into the box named q
But this doesnt:
<a href='#' onclick="javascript: document.getElementById('q').value = '<?php echo $firstName;?>';"><?php echo $firstName;?></a>
Might anyone know why?
Thanks in advance
Rob