jeff5656 Posted September 30, 2009 Share Posted September 30, 2009 Before storing this: $url = mysql_real_escape_string($_POST['url']); I want to get rid of the "http://" prefix, *if* it exists! Does anyone know how I could do this? Thanks! Link to comment https://forums.phpfreaks.com/topic/176071-strip-the-http/ Share on other sites More sharing options...
eatfishy Posted September 30, 2009 Share Posted September 30, 2009 You can do this with IF statement and Replace String Function() Link to comment https://forums.phpfreaks.com/topic/176071-strip-the-http/#findComment-927729 Share on other sites More sharing options...
cags Posted September 30, 2009 Share Posted September 30, 2009 <?php str_replace($_POST['url'], "http://", ""); ?> Link to comment https://forums.phpfreaks.com/topic/176071-strip-the-http/#findComment-927738 Share on other sites More sharing options...
jeff5656 Posted September 30, 2009 Author Share Posted September 30, 2009 When I do this: $url=str_replace($_POST['url'], "http://", ""); then I echo url and it is blank. Link to comment https://forums.phpfreaks.com/topic/176071-strip-the-http/#findComment-927843 Share on other sites More sharing options...
cags Posted September 30, 2009 Share Posted September 30, 2009 Oops, you would, I put them in the wrong order, my bad. That should have said... <?php str_replace("http://", "", $_POST['url']); ?> Link to comment https://forums.phpfreaks.com/topic/176071-strip-the-http/#findComment-927844 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.