Need to convert MySQL data block for a hyperlink using PHP -
i have table being displayed converts file uploaded location (docloc
) hyperlink. however, because filename has spaces in it, hyperlink drops them off. if display column docloc
shows:
uploading/minegem/gui-mgem-001 bullet programming.pdf
however, when click hyperlink get
uploading/minegem/gui-mgem-001
how can have hyperlink add rest of filename can open file link?
// printing table rows while($row = mysql_fetch_array($result)) { $docname=$row['docname']; $docver=$row['docver']; $doctype=$row['doctype']; $docloc=$row['docloc']; echo "<tr>"; echo "<td><a href=/uploading/$docloc>$docname</a></td>"; echo "<td>$docver</td>"; echo echo "</tr>"; } echo "</table>";
sorry if stupid, have done bit of googling , reading around here , i'm struggling. started learning php, mysql, , html 3 days ago.
encode url using urlencode:
echo '<td><a href="/uploading/'.urlencode($docloc).'">'.$docname.'</a></td>';
Comments
Post a Comment