note 14948 added to function.ereg.php
| From: | thibs at thibs dot com | Date: | Wed, 22 Aug 2001 10:33:46 +0000 |
| Subject: | note 14948 added to function.ereg.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-16982@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);}
}
http://www.php.net/manual/fr/function.ereg.php