简体   繁体   中英

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> ";
    }

你的结论是错的。你需要使用如下

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

try with:

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

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

You Missed Quotations In

tags Always Written in Double Quotations In Php.

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

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> ";
    }

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>';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM