TechnologyWonder Posted June 9, 2008 Share Posted June 9, 2008 I have a web form that allows user to upload there website address(URL) to a database. My problem is, all website addresses must be formatted in the same way. i.e., "http://www.domainname.com" Anthing after ".com" doesn't matter. and really all that matters is that "http://" comes before anything else. Anyone have any ideas? I know I will probably need some sort of if command that will check to see if http:// is present, if it is, allow form to post, if not, add it... Thanks. Link to comment https://forums.phpfreaks.com/topic/109454-stripping-characters/ Share on other sites More sharing options...
effigy Posted June 9, 2008 Share Posted June 9, 2008 if (preg_match('%^http://\S+%i', $string)) { echo 'OK'; } Link to comment https://forums.phpfreaks.com/topic/109454-stripping-characters/#findComment-561416 Share on other sites More sharing options...
TechnologyWonder Posted June 9, 2008 Author Share Posted June 9, 2008 Thanks, we'll give it a shot! Link to comment https://forums.phpfreaks.com/topic/109454-stripping-characters/#findComment-561423 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.