Passing Data with URLs

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Bob.H
Forum Newbie
Posts: 2
Joined: Thu Oct 17, 2002 3:26 am

Passing Data with URLs

Post by Bob.H »

Hi,
I am new to php and I have a small problem. I have a database (mysql) driven webpage displaying events and meeting. Some of these events have websites and or pdf documents for extra information.

At the moment when I fill my webpage with all the data, I only see the flat text of the link/document:

if ($row["link"] != "")
echo "\n<tr>\n\t<td bgcolor=\"#FFFFCC\">" .
"<b>Link: </b>" .
$row["link"] .
"</td>\n</tr>";

I have tried various combinations of "<a href=\"$row["link"]"\">, but none seem to work.

I would also like to let my users upload and download pdf documents. How can I do this?

Any information would be most greatfully appreciated.

Bob. H. :oops

?>
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

You don't really explain what you mean by 'none seem to work' - do you get error messages, does anything display, does the link not work when you click on it - however, try something like this:

Code: Select all

if (!empty($row&#1111;'link'])) {
	echo '&lt;tr&gt;&lt;td bgcolor="#FFFFCC"&gt;';
	echo '&lt;b&gt;Link: &lt;/b&gt;';
	echo '&lt;a href="'.$row&#1111;'link'].'"&gt;Link Text&lt;/a&gt;';
	echo '&lt;/td&gt;&lt;/tr&gt;';
}
As for uploading files have a look at:
http://www.php.net/manual/en/features.file-upload.php

To enable people to download a PDF you just have to give a link to that PDF's location.

Mac
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

try something like

Code: Select all

...
$query = ....
$result = mysql_query($query, $dbConn) or die(mysql_error());
while( $row = mysql_fetch_assoc($result) )
{
	...
	if (!empty($row&#1111;'link']))
		echo '&lt;tr&gt;&lt;td bgcolor="#FFFFCC"&gt;&lt;b&gt;Link: &lt;/b&gt;',$row&#1111;'link'], '&lt;/td&gt;&lt;/tr&gt;';
	...
}
...
edit: once again: too slow :?
Post Reply