Jump to content

URL in Profile edit


kayz100

Recommended Posts

i 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. Please only respond to what I am asking guys.

 

<?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">$input</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
Share on other sites

<?php
if (isset($_POST['btnsubmit']))
{
$input = "website is ".trim($_POST['website']);
//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">$input</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="btnsubmit">
</form>

use above code

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.