Adding hyperlinks to a table?

Adding hyperlinks to a table?

am 18.11.2005 15:37:59 von Sam

Hello!

I've been dabbling with PHP and MYSQL over the last month or so. I like
it! However, I'm stumped and hope you guys 'n' gals can give me some
advice.

I can visualise what I want to achive but don't know how complex, (or
easy :o), this will be to do in practice.

* I have a simple MySQL database containing User ID, Country, Postcode
and Date.

* I extract this information and display it in a table, depending on
which user is logged in. (I use sessions). Typically, there will be 4
or 5 rows of data displayed for each user.

I want to have an image, (a button), displayed alongside each row which
the user can click on to select that row.

When clicked, this button should take the User ID and Postcode for it's
row and pass this to another PHP function.

Easy?!?!!
Hard!??!!
Impossible?!!?

Hit me with it, guys :o)

Sam Day.

Re: Adding hyperlinks to a table?

am 18.11.2005 16:51:33 von Shion

Sam wrote:
> Hello!
>
> I've been dabbling with PHP and MYSQL over the last month or so. I like
> it! However, I'm stumped and hope you guys 'n' gals can give me some
> advice.
>
> I can visualise what I want to achive but don't know how complex, (or
> easy :o), this will be to do in practice.
>
> * I have a simple MySQL database containing User ID, Country, Postcode
> and Date.
>
> * I extract this information and display it in a table, depending on
> which user is logged in. (I use sessions). Typically, there will be 4
> or 5 rows of data displayed for each user.
>
> I want to have an image, (a button), displayed alongside each row which
> the user can click on to select that row.
>
> When clicked, this button should take the User ID and Postcode for it's
> row and pass this to another PHP function.

src='images/ugglypicture.png' border='0'>"; ?>

You need to set the $url_to_page to which page to load and $id needs to be set
to the user id while $postcode needs to be set to the post code.

Of course you could store the values needed in the session and just have a
simple link.


//Aho

Re: Adding hyperlinks to a table?

am 19.11.2005 01:32:05 von salmondays2000

>> >> src='images/ugglypicture.png' border='0'>"; ?>

>> You need to set the $url_to_page to which page to load and $id needs to be set
>> to the user id while $postcode needs to be set to the post code.

Thanks so much for the quick reply!!

This kind of makes sense - but will this work for multiple rows - each
with their own button.

For example - this is what my HTML table may look like:

England HP19 3TY 10/08/2006
<

Re: Adding hyperlinks to a table?

am 19.11.2005 08:35:56 von Shion

Sam wrote:
>>> >>> src='images/uglypicture.png' border='0'>"; ?>
>
>>> You need to set the $url_to_page to which page to load and $id needs to be set
>>> to the user id while $postcode needs to be set to the post code.
>
> Thanks so much for the quick reply!!
>
> This kind of makes sense - but will this work for multiple rows - each
> with their own button.
>
> For example - this is what my HTML table may look like:
>
> England HP19 3TY 10/08/2006
> <

Re: Adding hyperlinks to a table?

am 19.11.2005 19:16:24 von salmondays2000

>> My example requires that you fetch the data from the sql table in a special order

Ahhhhhh.... I see!

That's really cool :o)

Thanks *very* much!

Sam Day.

Re: Adding hyperlinks to a table?

am 11.01.2006 04:43:07 von Jim Michaels

I will take it a step further. it sounded like you wanted to change the
image too. easy enough. just make flag (or whatever) images for the
appropriate countries using the country name as a base filename, and do this
slight modification (and by the way, you can use column names instead of
numbered array indices, and you can do away with the concatenation):

while($row=mysql_fetch_array($result) {
echo
"$row[Contry]$row[Postcode]$row[Button]";
}

change it to
while($row=mysql_fetch_array($result) {
echo
"$row[Contry]$row[Postcode]$row[Date] href='http://$url_to_page?ID=$row[Button]&Zip=$row[Postcode] '> src='images/$row[Contry].png' border='0'>\n";
}



"J.O. Aho" wrote in message
news:3u82utFvkcriU1@individual.net...
> Sam wrote:
>>>> >>>> src='images/uglypicture.png' border='0'>"; ?>
>>
>>>> You need to set the $url_to_page to which page to load and $id needs to
>>>> be set
>>>> to the user id while $postcode needs to be set to the post code.
>>
>> Thanks so much for the quick reply!!
>>
>> This kind of makes sense - but will this work for multiple rows - each
>> with their own button.
>>
>> For example - this is what my HTML table may look like:
>>
>> England HP19 3TY 10/08/2006
>> <