php - how can i send a value onclick on a image in javascript to get a value in to a text field -


i want value database coresponding image onclick. function not working can't define value in img tag how can send value function.

please help.

<script type="text/javascript">     function choose(x)     {     document.getelementbyid('color').value=x;     } </script> <img src="admin/upload/<?php echo $data['image'];?>" value="<?php echo $data['color'];?>" width="25" height="25" onclick="choose(this.value);"/> 

<script type="text/javascript"> function choose(x) { document.getelementbyid('color').value=x; } </script> <img src="admin/upload/<?php echo $data['image'];?>" title="<?php echo $data['color'];?>" width="25" height="25" onclick="choose(this.title);"/> 

just change attribute value title , onclick="choose(this.title)"


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -