mattichu Posted June 5, 2013 Share Posted June 5, 2013 Hi! Im using the following code to change an image from a tick to a cross: <script type="text/javascript"> imgs=Array("/new4/images/allow.png","/new4/images/deny.png"); var x=0; function change() { document.getElementById("bob").src=imgs[++x]; if (x==1) { x=-1; } } </script> <img id="bob" height="20" width="20"src="/new4/images/allow.png" onmousedown="change()"> How would I go about storing the option the user has left it on in an SQL database? any help much appreciated! Link to comment https://forums.phpfreaks.com/topic/278786-changing-img-src-onmousedown/ Share on other sites More sharing options...
DavidAM Posted June 5, 2013 Share Posted June 5, 2013 You would have to send it to a script on the server, probably using AJAX. If it has something to do with a form that will be POSTed, then you can put a hidden field on the form and assign it a value indicating checked or unchecked; then process it with the rest of the form when POSTed. Link to comment https://forums.phpfreaks.com/topic/278786-changing-img-src-onmousedown/#findComment-1434165 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.