Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,501 members, 7,819,818 topics. Date: Tuesday, 07 May 2024 at 12:45 AM

Help On Php Form - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Help On Php Form (739 Views)

Using Finger Print Scanner On PHP / Help On Php Code For A Dice Game / Free Ebooks On Php Progaming (2) (3) (4)

(1) (Reply) (Go Down)

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 it
Secondly, i need a working php pagination function script..
Thanks
Do 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:
Do you mean after submitting of the form or instant converting of the tag to link?
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:
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
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:
Do you know regular expression in PHP?
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)

Microsoft Labels US Government A ‘persistent Threat' In Plan To Cut Off NSA Spyi / Pleash How Can I Create A Simple Cost Calculator / Create Your Own Machine Learning Powered RSS Reader In Under 30 Minutes

(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. 12
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.