Geocoding for openstreetmap

Hi Team,
I have 2 text box one is called from address and another one is called to address. Now I have search button on click of search button i want to display the distance between from address and to address.
Suppose I have London in from address and France in to address now if i click on search button it should show the distance between these two places.
How I can do that, I know I have to do geocoding for that but I am a very novice person in geocoding.
Could you please let me know the steps or sample code for this.
Thanks in advance

First of all you have to tell us whether the distance is desired in a straight air line (as drawn like a ruler) or do you want to measure along streets or ways in the OSM data?

The first option is a matter of geometry, for street routing look at