Hi, I am wondering how I can use PHP and MySQL to make it easier for me to make links.
If you look on the picture I have attached, you can see how I want my page to look like.
I want to be able to copy and paste a link address (from f.eks Youtube) into my "Link Address" Field. And then I want to type in a name for my link(Watch Trailer!).
Then I want to be able to press "submit" and the link will appear like shown of the picture.

I want to use PHP and MySQL to accomplish this. I want the page to get the "link address" info and the "link name" info from my server which is running MyPHPadmin.

If someone could post the code for this it would be much appreciated.

If there is a simpler way or a more efficient way to handle this, please don't hesitate to post a better solution.

Recommended Answers

All 2 Replies

so you have to use get or post method in your page.
then in other page u can use your values,just fetch them and store them with insert query in mysql database.
example for get method
$value1 = $_get;
$value2 = $_get;
example for post method
$value1 = $_post;
$value2 = $_post;
if you successfully stored them in database then u can use paging to represent your stored data in good manner.

i hope this will help u.

Your form would need to be posted, i will show you how to create the "generator and link the form to it.

I will assume you already have a database table called links in you SQL


Generator.php

<?
$link = $_POST['link'];
$title = $_POST['title'];
echo '<a href="'.$link.'">'.$title.'</a>';
mysql_query("INSERT INTO links (title, link) VALUES ('$title', '$link')");
?>

Form.html

<form action="generator.php" method="post">
Title: <input type="text" name="title" />
Link: <input type="text" name="link" />
</form>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.