note 14948 deleted from function.ereg by jimw

From: Date: Fri, 02 Nov 2001 01:30:07 +0000
Subject: note 14948 deleted from function.ereg by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-20159@lists.php.net to get a copy of this message
I allow users to post URLs right on the site. On my HTML form, there is a pre-written "http://" in the dedicated field. (<input name="url" value="http://">) The following code allow you to : -remove the "http://" if the user doesn't complete the field -add the "http://" if the user remove it but has completed the field /* Elimine le http si aucune info web est remplie */ if ($url == "http://") { $url = ""; } /* Rajoute le http si l utilisateur l a retire */ if ($url != "") { if (ereg ("^[^http://]",$url)) {$url=(("http://").$url);} }

« previous php.notes (#20159) next »