我的链接有什么问题?

时间:2011-12-21 18:05:34

标签: php anchor echo

我试图在一个链接中回显一个数组值,但它在Dreamweaver中出现是一个错误,但我无法弄清楚我做错了什么,有人能告诉我这条线有什么问题吗? 谢谢: - )

echo '<a href="index.php?option=com_chronoforms&chronoform=deletelead&token=echo $detail['cf_uid'];"></a>';

编辑&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; &GT; 这是完整的代码:

$result = mysql_query("SELECT * FROM hqfjt_chronoforms_data_addemailtemplate");
while ($row = mysql_fetch_object($result)) {
    echo '<div class="namerow">';
    echo '<th>';
    echo $row->emailformname;
    echo '</th>';
    echo '</div>';
    echo '<div class="messagerow">';
    echo '<th>';
    echo $row->emailformmessage;
    echo '<a href="index.php?option=com_chronoforms&chronoform=deletelead&token=echo        $detail[cf_uid]">dssd</a>';

    echo '<tr></tr>';
    echo '</div>';
}
echo '</th>';
mysql_free_result($result);

如果我回应cf_uid     echo $ row-&gt; cf_uid; 这工作正常,并在表格中显示它旁边的每条记录的唯一ID,我只需要将那个正在回显的ID放入链接的末尾,使其看起来像http://link&token=2626382837728 &LT;&LT; (cf_uid)


固定! 感谢大家对这项工作的帮助,我弄清楚到底出了什么问题,我认为阵列似乎没有,这段代码最终工作了&gt;&gt;

$result = mysql_query("SELECT * FROM hqfjt_chronoforms_data_addemailtemplate");

while ($row = mysql_fetch_object($result)) {
    echo '<div class="namerow">';
    echo '<th>';
    echo $row->emailformname;
    echo '</th>';
    echo '</div>';
    echo '<div class="messagerow">';
    echo '<th>';
    echo $row->emailformmessage;
    $id = $row->cf_uid;
    echo '<a href="index.php?option=com_chronoforms&chronoform=deletelead&token=' . $id . '">LINK</a>';
    echo '<tr></tr>';
    echo '</div>';
}
echo '</th>';
mysql_free_result($result);

3 个答案:

答案 0 :(得分:0)

尝试将字符串和变量分开。

echo '<a href="index.php?option=com_chronoforms&chronoform=deletelead&token=' . $detail['cf_uid'] . '"></a>';

更新:如果你在这一行收到错误,问题可能就是之前的行!

答案 1 :(得分:0)

echo "<a href=\"index.php?option=com_chronoforms&chronoform=deletelead&token=".$detail['cf_uid']."\">SOME NAME FOR THE LINK</a>";

[根据更新的帖子编辑]

使用此:

echo '<a href="index.php?option=com_chronoforms&chronoform=deletelead&token=' . $detail['cf_uid'] . '">dssd</a>';

但是,我必须问......是否有一个数组变量$detail,它有一个键'cf_uid'?你得到了什么语法错误(在你尝试之后)?

[根据评论编辑]

因为它是$row,因为它是一个对象:

echo '<a href="index.php?option=com_chronoforms&chronoform=deletelead&token=' . $row->cf_uid . '">dssd</a>';

答案 2 :(得分:0)

或者你可以尝试这个

echo '<a href="index.php?option=com_chronoforms&chronoform=deletelead&token='. $detail['cf_uid'].'"></a>';

这样你就可以连接字符串

相关问题