user4605739
user4605739

Reputation:

PHP: trying to create a new line with <br

I am trying to create a new line between product $id and $name but however I am getting an error, please could you help me.

echo "<a href='searchdetails2.php?vid=".$id."'>".<br />$name. "</a> ";
    }

    echo "<a href='searchdetails2.php?vid=".$id."'>".<br />$name. "</a> ";
    }

Upvotes: 2

Views: 78

Answers (5)

PREM
PREM

Reputation: 114

You Missed Quotations In

tags Always Written in Double Quotations In Php.

echo "<a href='searchdetails2.php?vid=".$id."'><br />".$name."</a> ";

Upvotes: 2

Mohammad
Mohammad

Reputation: 3547

you have missed up with the quotations

change it to this

echo "<a href='searchdetails2.php?vid=$id'><br />$name</a> ";
    }

    echo "<a href='searchdetails2.php?vid=$id'><br />$name</a> ";
    }

Upvotes: 1

Vignesh
Vignesh

Reputation: 1063

You are concating a html element as a php constant. Any html should be surrounded with quotes lie this. echo '<a href="searchdetails2.php?vid='.$id."'><br />'.$name.'</a>';

Upvotes: 0

Tudor Constantin
Tudor Constantin

Reputation: 26861

try with:

echo "<a href='searchdetails2.php?vid=".$id."'><br />".$name. "</a> ";
    }

    echo "<a href='searchdetails2.php?vid=".$id."'><br />".$name. "</a> ";
    }

Upvotes: 2

I&#39;m Geeker
I&#39;m Geeker

Reputation: 4637

Your concat is wrong.you need to use like below

echo "<a href='searchdetails2.php?vid=".$id."'><br />".$name."</a> ";

Upvotes: 3

Related Questions