Q:

Get an id to another page

Hello this is my first post here, I need your help.
First of all, I want to say sorry for my bad English. I hope you will understand me :D
So, I'm a newbie in php and I have a problem.
I want to take the id from a file, to another file, but I don't know how. I will show you my code below.
            while($array = $db->get_row($row))
        {
            $id = $array['id'];
            $Nume = $array['user_name'];
            $date = date("Y-m-d H:i:s", $array['date']);;
            $stitle = $array['shorttext'];
            $text = $array['text'];
            $logs .= '
                <div class="post">
                    <div class="post-meta clearfix">
                        <h4 class="post-title left">
                            <a href="/index.php?page=news id='.$id.'">'.$stitle.'</a>
                            </h4>
                            <p class="post-info right">
                            <span>'.$Nume.'</span>
                            '.$date.'
                            </p>
                            </div>
                            <div class="post-box">
                            <div class="post-content">
                            <div class="post-intro">
                            '.$text.'
                            </div>
                            </div>
                            <div class="post-footer clearfix">
                            <div class="continue-reading">
                            </div>
                        </div>
                    </div>
                </div>
                <br>
                ';
        }

Here where is ID, I want to take that id to the news page. (the code is in index.php)
<a href="/index.php?page=news?id='.$id.'">'.$stitle.'</a>

In news.php have to select from mysql all but only the table with the ID from index.php
if(isset($_GET['id']))
{
    $id = (int)$_GET['id'];
    $row = $db->sql("SELECT * FROM `ucp_news` WHERE `id` = '".$id."' ");
    $array = $db->get_array($row);

Can you help me, please?

A:

Your PHP code is correct, although you should be using htmlspecialchars() when adding the variables to the output. This to prevent XSS attacks, and the like.
Though, your problem lies most likely in this line:
<a href="/index.php?page=news id='.$id.'">

More specifically, the missing ampersand (&) between news and id. Try to look at the value of $_GET['page'] when clicking on the link, then you should see what the problem is.

