Click here to Skip to main content
11,583,555 members (66,345 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL PHP
I would like to do what the title says, make it so that if i click an image it saves its url to a sql database... I know how to do all the sql insert stuff but how do i make it save the url???

I have no code because i don't know where to start.
Posted 13-Jul-14 6:34am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You can always start here:

http://www.htmlcodetutorial.com/forms/_INPUT_onClick.html[^]

or here:

http://www.w3schools.com/jsref/event_onclick.asp[^]

Then you need to write a method that gets the URL into a variable.
One way is to use JavaScript.
<script>
    var myURL;
    function copyText()
    {
       myURL = document.getElementById("field1").value;
    }
</script>

Then save that variable into your database.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 390
1 Dave Kreskowiak 230
2 Sergey Alexandrovich Kryukov 210
3 virusstorm 209
4 Richard Deeming 180
0 OriginalGriff 1,523
1 Sergey Alexandrovich Kryukov 995
2 Abhinav S 696
3 Dave Kreskowiak 621
4 Suvendu Shekhar Giri 568


Advertise | Privacy | Mobile
Web04 | 2.8.150603.1 | Last Updated 14 Jul 2014
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100