Re: php code to upload a url correctly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

on 01/26/2007 12:10 PM Corden James (RW3) CM&MC Manchester said the
following:
> I have a form in which users submit a url. I am having problems as some
> people submit the url in the format http://www.blah.blah.org
> <http://www.blah.blah.org/>  while others submit in the format
> www.blah.blah.org <http://www.blah.blah.org/>  I have designed the form
> so that it seems fairly obvious (to me anyway) not to include the
> http:// but people are still doing it (presumably because they are
> copying and pasting from a browser). My form processing script is
> designed to add http:// to the submitted url and place the modified url
> in a database for future use. As you can imagine sometimes I end up with
> urls such as http://http://www.blah.blah.org
> <http://http:/www.blah.blah.org>  in my database. Hence I need a more
> rigorous form processing script that is capable of first checking if the
> url includes http:// and then processes accordingly. Can anyone point me
> in the right direction for such a script?

I use a solution for that a lot of times that consists on using regular
expressions to fill eventually missing characters in the URL.

I use a popular forms generation and validation class that allows me to
replace string patterns. It works on client side with Javascript and
also on server side with the class itself. When using this class, you do
not need to know any Javascript. Just define how you want to replace the
string value patterns.

Here you may find a live example form that demonstrates that:

http://www.meta-language.net/forms-examples.html?example=test_form

See the test_form.php example form script to see how it works in action.

http://www.phpclasses.org/formsgeneration

Oh, here you may find a tutorial video that explains all the features
demonstrated by that example:

http://www.phpclasses.org/browse/package/1/video/1/section/example-form.html

-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux