kayz100 Posted August 1, 2013 Share Posted August 1, 2013 Hi guys, I have been stuck for a few days now. My PHP programming is much better but stuck a little on a project. How do I get users to input their own website URL into my website so that they can easily be linked to my website. Below is the little code which I am failing to get users to input their own website url. I can use the code if I type in my own website before FTPing the account but that's not what I am looking for: I actually want users to input their own url for example www.mywebsite.com only and this then gets saved onto the database, which I have already, thanks a lot. feel free to email me [email protected] <?php $input= "website is http://www.nameofsite.com"; //the above works fine but i want it empty so users can input their own hyperlinked urls $clickable = preg_replace('*(f|ht)tps?://[A-Za-z0-9\./?=\+&%]+*', '<a href="$0">$0</a>', $input); echo $clickable; ?> <form action="" method="POST">Update your URL<br /> Email: <input type="text" value="php url" name="email"> Website: <input type="text" value="php url" name="website"> <input type="submit" value="submit" name="submit"> </form> Thanks a lot guys Kayz100 Link to comment https://forums.phpfreaks.com/topic/280706-users-inputting-url-to-profile/ Share on other sites More sharing options...
Muddy_Funster Posted August 1, 2013 Share Posted August 1, 2013 What is your regex doing? and you do know that $0 is NOT a valid variable name? Link to comment https://forums.phpfreaks.com/topic/280706-users-inputting-url-to-profile/#findComment-1442917 Share on other sites More sharing options...
kayz100 Posted August 1, 2013 Author Share Posted August 1, 2013 Sorry about the $0 my mistake. Please help me guys in getting this to work for my users thank you Link to comment https://forums.phpfreaks.com/topic/280706-users-inputting-url-to-profile/#findComment-1442926 Share on other sites More sharing options...
Muddy_Funster Posted August 1, 2013 Share Posted August 1, 2013 so your new code is? And your regex is doing? Link to comment https://forums.phpfreaks.com/topic/280706-users-inputting-url-to-profile/#findComment-1442933 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.