Jump to content

mysql result as hyperlink


silas101

Recommended Posts

"Select '<a href="javascript:pick(' + field + ')">click me!</a>'  from table

 

how can i do this select to return me a link like

<a href="javascript:pick(' GOLD ')">click me!</a>

 

in php on mysql.

 

i just want to build a list form that i can click to return the value to the calling form

Thanks ;D

Link to comment
https://forums.phpfreaks.com/topic/173775-mysql-result-as-hyperlink/
Share on other sites

Hi sila101,

 

You wouldn't be able to do it that way, and it's the not the right way to do it anyway.  You need to make the select and then pass that variable into the HTML code.  Something like:

 

mysql_query("SELECT field FROM yourdatabase");
while ($a=mysql_fetch_array($sql))
{
extract $a;
echo '<a href="javascript:pick(\' '.$a[colour].' \')">click me!</a>';
}

 

Something like the above should work.

 

Hope this helps!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.