iarp Posted May 21, 2008 Share Posted May 21, 2008 Hey, if (empty($_POST['page_url'])) { $name = $_POST['page_name']; $purl = preg_replace(' ', '-', $name); } else { $purl = escape_data($_POST['page_url']); } $_POST['page_name']; = let's stay... "example one" should that not set $purl = example-one ? Quote Link to comment https://forums.phpfreaks.com/topic/106655-solved-preg_replace-not-working-or-im-wrong/ Share on other sites More sharing options...
soycharliente Posted May 21, 2008 Share Posted May 21, 2008 <?php $purl = implode("-", explode(" ", $name)); ?> Quote Link to comment https://forums.phpfreaks.com/topic/106655-solved-preg_replace-not-working-or-im-wrong/#findComment-546676 Share on other sites More sharing options...
effigy Posted May 21, 2008 Share Posted May 21, 2008 PREG patterns require delimiters, e.g., / /. For something this simple, use str_replace. Quote Link to comment https://forums.phpfreaks.com/topic/106655-solved-preg_replace-not-working-or-im-wrong/#findComment-546678 Share on other sites More sharing options...
iarp Posted May 21, 2008 Author Share Posted May 21, 2008 Noted for next time. Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/106655-solved-preg_replace-not-working-or-im-wrong/#findComment-546680 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.