I have a form to add content in database(addcontent.php) and one file which shows the content(content.php).Database has id,title,content columns. IS it possible to make the content.php to "$_GET" the id's from the database and show them on the page as : content.php?id=1

And other thing. i have buttons in content.php which i want to make them dinamicaly working (hyperlink to sent to "content.php?id=2" and etc.)

All help will be appresiated :)

You're a bit confused with how $_GET works.

On your content.php page if you want to pull the 'id's from the db and use them in a hyperlink it would be done like so:

$query=mysql_query("SELECT id FROM table_name WHERE id <> '' ");

echo '<a href="content.php?id='.$id.'">Some Text</a>';

This will create a hyperlink for every id in your table. Since you want to put this code on page "content.php" all it's really going to do is reload the page with a different 'id' in the url when it's clicked.

When the page reloads you can then $_GET the id as such if that is what you want to do:


The value of $get_id will change each time a new link is clicked.

thanks that is what i was looking for.But is it possible to make it in one link like this :

i press the link on first content page and it sends me to "content.php?id=2" on this page the button sends me to "content.php?id=3" and etc.

and how can i load content by id?

thanks waiting for your answer :)

and here is the content.php if its needed :

content.php(with your solution)

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
$con=mysql_connect('sql202.000page.com','page0_4100868','332211')or die(mysql_error());
$db=mysql_select_db("page0_4100868_quiz",$con)or die(mysql_error());
$text = mysql_query("SELECT * FROM content")or die(mysql_error());
$result = mysql_fetch_array($text)or die(mysql_error());
$getid = mysql_query("SELECT id FROM content WHERE id <> ''")or die (mysql_error());
echo "<b>".nl2br($result["title"]);
echo "<br>";
echo "<font color='blue'>".nl2br($result["content"])."</font>";
<br />
<input type="button" value ="Следваш тест" onClick="window.location.href=content.php?id=<?php echo $id ?>"  />
<input type="button" value ="Реши тест" onClick="window.location.href='quiz1.php'" />

echo '<a href="content.php?id='.$id.'">Some Text</a>';