John
John

Reputation: 4944

GET Variable Problem

The table below works well. However, I am trying to pass $row["username"] along as a GET variable on the second hyperlink (the hyperlink in the second row that is class "sitename2" below). When I hover over this hyperlink, everything is blank after the "profile="... there is no $row["username"] to be passed along. Any idea why the $row["username"] is not being appended to the end of this URL?

Thanks in advance,

John

EDIT: Sorry, I missed a simple mistake here. Thanks for the help... sorry for taking your time.

<?php


$sqlStr = "SELECT s.loginid, s.title, s.url, s.displayurl, l.username
             FROM submission AS s,
                  login AS l
            WHERE s.loginid = l.loginid
         ORDER BY s.datesubmitted DESC
            LIMIT 10";


$result = mysql_query($sqlStr);

$arr = array(); 
echo "<table class=\"samplesrec\">";
while ($row = mysql_fetch_array($result)) { 
    echo '<tr>';
    echo '<td class="sitename1"><a href="http://www.'.$row["url"].'">'.$row["title"].'</a></td>';
    echo '</tr>';
    echo '<tr>';
    echo '<td class="sitename2"><a href="http://www..../sandbox/members/index.php?profile=">'.$row["username"].'</a></td>';
    echo '</tr>';
    }
echo "</table>";    




?>

Upvotes: 0

Views: 84

Answers (3)

Tyler Carter
Tyler Carter

Reputation: 61577

Try:

echo '<td class="sitename2"><a href="http://www.foo.com/sandbox/members/index.php?profile='.$row["username"].'">'.$row["username"].'</a></td>';
echo '</tr>';

Upvotes: 1

YOU
YOU

Reputation: 123897

Because in your code, there is nothing after profile, see ?profile="

echo '.../index.php?profile=">'.$row["username"].'</a></td>';

You could add like this

echo '.../index.php?profile='.$row["username"].'">'.$row["username"].'</a></td>';

Upvotes: 1

Matthew Flaschen
Matthew Flaschen

Reputation: 285017

Because you're only putting it in the anchor?

Try:

echo '<td class="sitename2"><a href="http://www.foo.com/sandbox/members/index.php?profile=' . $row["username"] . '">'.$row["username"].'</a></td>';

Upvotes: 0

Related Questions