Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,194,814 members, 7,956,078 topics. Date: Monday, 23 September 2024 at 12:39 AM |
Nairaland Forum / Science/Technology / Programming / Help On Php Form (755 Views)
Using Finger Print Scanner On PHP / Help On Php Code For A Dice Game / Free Ebooks On Php Progaming (2) (3) (4)
Help On Php Form by Taiw(m): 7:26am On Dec 05, 2013 |
I want a situation where when a user types the <a href></a> tag in a form, it automatically converts it to a link..How do i go about it Secondly, i need a working php pagination function script.. Thanks |
Re: Help On Php Form by greenPHP(m): 9:14am On Dec 06, 2013 |
Taiw: I want a situation where when a user types the <a href></a> tag in a form, it automatically converts it to a link..How do i go about itDo you mean after submitting of the form or instant converting of the tag to link? |
Re: Help On Php Form by Taiw(m): 1:11pm On Dec 07, 2013 |
greenPHP:I mean after submitting the form. Any inputs filled using the <a href></a> tags should automatically convert it to hyperlink dat can b displayed on my page. my form echos back the tags instead of converting it to clickable hyperlinks |
Re: Help On Php Form by greenPHP(m): 5:00pm On Dec 07, 2013 |
Taiw:Do you know regular expression in PHP? |
Re: Help On Php Form by Eesyboi: 7:00pm On Dec 07, 2013 |
Have you tried the PHP htmlspecialchars_decode() Function? |
Re: Help On Php Form by Taiw(m): 10:10pm On Dec 07, 2013 |
greenPHP:after hours of searching i found this $text = preg_replace('@(https?://([-\w\.]+) +(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', '<a href="$1">$1</a>', $text); how do i go from here |
Re: Help On Php Form by Taiw(m): 2:41am On Dec 08, 2013 |
got it now <?php $text = "hello http://example.com sample [Name of Link](http://www.yourlink.com/) [Name of a](http://www.world.com/) [Name of Link](http://www.hello.com/) <a href=\"http://stackoverflow.com\">hello world</a> <a href='http://php.net'>php</a> "; echo nl2br(make_clickable($text)); function make_clickable($text) { $text = preg_replace_callback( '#\[(.+)\]\((\bhttps?://[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|)/))\)#', create_function( '$matches', 'return "<a href=\'{$matches[2]}\'>{$matches[1]}</a>";' ), $text ); $text = preg_replace_callback('#(?<!href\=[\'"])(https?|ftp|file)://[-A-Za-z0-9+&@\#/%()?=~_|$!:,.;]*[-A-Za-z0-9+&@\#/%()=~_|$]#', create_function( '$matches', 'return "<a href=\'{$matches[0]}\'>{$matches[0]}</a>";' ), $text); return $text; } |
(1) (Reply)
Software Apps Mean Jobs For Young Nigerians / Practical Use Of Session In PHP / Death Sentence For Hackers: FG Sends New Cybercrime Bill To National Assembly
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 13 |