php variable to make clean URL in a HTML form value that show the result

How I can make a html form that you put the information in a input an give you the result of the data in a clean URL in the next input, this is how far i get, the function works, i need that the first value (slugit) goes to the function, i leave the code, i will be happy if some one can help me: