echo - Putting fetched array into <a href> value in PHP -
i have sql query statement return particular set of result. such id, names, price. have no problem that.
however trying add link within echo loop , set id value can post page. possible ?
while ($row = mysql_fetch_array($result)) { echo "".$row{'url'}."<br>"; echo "name:".$row{'name'}."<br>"; echo "price: $ ".$row{'price'}."<br>"; echo '<div class = "qwerty" data-countdown= '.$row{'time'}.'></div>'; echo "location:".$row{'location'}."<br>"; echo "description:".$row{'description'}."<br>"; echo ''.$row{'id'}.''; echo '<a href="" onclick="jsscript()">show comments</a> <form id="displaycomments" style="display:none" target="jsscript()" method="post"> <input type="hidden" name="run" value=".$row{'id'}." /> </form>';
you missed quotes. value="'.$row['id'].'"
echo '<a href="" onclick="jsscript()">show comments</a> <form id="displaycomments" style="display:none" target="jsscript()" method="post"> <input type="hidden" name="run" value="'.$row['id'].'" /> </form>';
and php array use [ ]
Comments
Post a Comment