Reputation: 1
I have a html form on my php webpage. There are four input box. And I'm adding new data with these.
I want to do that, when I write something in input box1, input box2 will be same but with "-" instead of a space..
For example when I write "how are you" to input box1, input box2 must be "how-are-you".. How can I do that? :/
Upvotes: 0
Views: 80
Reputation: 3441
just add this JavaScript on your page
document.getElementById('box1').onkeyup = function (){
document.getElementById('box2').value = document.getElementById('box1').value.replace(' ','-')
}
Upvotes: 1
Reputation: 71422
You need to use javascript in order to do this without a page reload. PHP only operates on the server.
Upvotes: 0
Reputation: 127
You could do this with a simple bit of jQuery. When the text in the first box changes, set the text in the second box.
Upvotes: 0