I'm trying to develop the best way to store a URL into a database, and make sure it has either http://www. or https://www., etc., correctly place infront of it. So if someone put in stackoverflow.com, it'd correct it to https://www.stackoverflow.com instead. That way when it echos out the url on the page and is clicked, I won't have to worry about the link breaking.
Also, the second part of this, I have tried to just straight up store a link inside a database, and sometimes it won't allow it when submitting via php/mysqli. I think it was a character or something like that, that wouldn't allow it to be stored. Should I encrypt the link and then decrypt it upon showing on the page?
I greatly appreciate the help, and none of the things I searched on google were helping, and trying to get a site for a charity done for an event for then.