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 ? 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)); ?> 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. 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. 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
Archived
This topic is now archived and is closed to further replies.