Silent Pond Silent Pond - 2 years ago 102
PHP Question

Rediricting url dynamically from dynamically populated links

a mysql database has following three columns:

id url_href url
1 yahoo
2 google
3 bing

i use the following query to get the value

mysql_select_db($database_XYZ, $XYZ);
$query_urlencoder = "SELECT id, url_href, url FROM sites WHERE id >0 ORDER BY id DESC";
$urlencoder = mysql_query($query_urlencoder, $XYZ) or die(mysql_error());
$row_urlencoder = mysql_fetch_assoc($urlencoder);
$totalRows_urlencoder = mysql_num_rows($urlencoder);

the href tag

<a href="redirect.php?encodeurl=<?php echo $row_urlencoder['url']; ?>" target="_blank"><?php echo $row_urlencoder['url_href']; ?></a>

populate links on page dynamically based on repeat region like,


and clicking above links take the users respectively to


but those actually aren't redirected to the respective url like

how can i redirect the href links to the the above url in this case? any suggestion or reference shall be thankfully appreciated.

Answer Source

Use urlencode php function

redirect.php?encodeurl=<?php echo urlencode($row_urlencoder['url']); ?>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download