3
Contributors
9
Replies
10
Views
10 Years
Discussion Span
Last Post by dss
0

Something like:

echo("<a href=\"mylink.htm\">$title</a>");

(I haven't tested that so I can't guarantee it being typo-free. PHP is unforgiving ;))

0

Something like:

echo("<a href=\"mylink.htm\">$title</a>");

(I haven't tested that so I can't guarantee it being typo-free. PHP is unforgiving ;))

Thanks man. The link by the way is created dunamically do I have to use anytthing different to have a variable plug in the value rather than actually using the address.

0

Well, I assume that each incarnation of 'title' will have a different target url, so what do you think you will have to do for that...?

If we assume that 'title' is also the actual url as well as the link text, then:

echo("<a href=\"$title\">$title</a>");

If the url and the link text are different then you'll need to provide another variable or string of text for each iteration.

0

when the user does the search he/she selects a system to search under. then that is put through a switch statement and the $var variable determines the address i.e. www.foo.bar/nes/roms/ the $title is then put in after from the location field of the table and the hyperlink works. I have it tell me the right location I just have not been able to make it a link. Thanks for all your help. The problem was not the link but making the dynamic table with the link included. I got confused with alll the echos and other punctation marks. Thanks for all your help.

0

It is giving me an error. This is what I entered:

$title = $row["location"];
		echo "<tr>
			<td>";
			echo "<a href="$link$title">$title</a>";
			echo "</td><td>";
			echo "</td></tr>";
			$count++;

IT gives me this error:

Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /var/www/web2/web/romSite/process.php on line 123

What am I doing wrong>

0

You can't use " inside the echo - you have to escape any occurence of " with \", so that line in the middle should be:

echo ("<a href=\"$link$title\">$title</a>");

Otherwise PHP thinks the echo has ended and gets messed up. And you should put ( and ) each end of the echo containing the "s which are part of the syntax.

Same on your other lines - put the ( and ) in. So:

$title = $row["location"];
        echo "<tr><td>";
            echo ("<a href=\"$link$title\">$title</a>)";
            echo ("</td><td>");
            echo ("</td></tr>");
            $count++;

But I'm also a bit confused about $link$title in the anchor tag. What would each variable typically contain in an iteration?

0

thanks a lot man. I was wondering what all the wierd characters. I am used to c++. It is a little more plain than this. Shockingly similar though like the switch statement is almost the same as one I built for c++ class. Well thanks. I am really glad you explained why so now I can apply that to other things. Thanks again

0

It is giving me an error. This is what I entered:

$title = $row["location"];
        echo "<tr>
            <td>";
            echo "<a href="$link$title">$title</a>";
            echo "</td><td>";
            echo "</td></tr>";
            $count++;

IT gives me this error:

Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /var/www/web2/web/romSite/process.php on line 123

What am I doing wrong>

Hi,
YOu can also use it like

echo "<a href="{$link$title}">{$title}</a>";

Accouding to me when we require a output from a variable between double quotes use "<a href="{$link$title}">{$title}</a>";


Thankyou

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.