how to take the word of the link clicked and send to the page that the link sends

Asked

Viewed 289 times

1

I don’t know if the question is clear, but come on. I’ve got that code here:

<html>
	<head>
		<META CHARSET="UTF-8">
		<META NAME="author" VALUE="Fernando Aguiar Pinedo">
		<LINK REL="stylesheet" HREF="css.css">
		<LINK REL="shortcut icon" HREF="favicon.ico">
	</head>
	<body>
		<div id="cabeçalho">
			<h1>Music Downloader</h1>
			<p>Download Your Music Here</p>
		</div>
		<div id="filterlist">
			<ul>
				<h1 style="font-family:calibri; margin:5px; text-align:center;">Genre</h1>
				<li>Rock</li>
				<li>Eletronic</li>
				<li>Pop</li>
				<li>Reggae</li>
				<li>Hip Hop</li>
				<li>Anime</li>
				<li>Video Game</li>
			</ul>
			<ul>
				<h1 style="font-family:calibri; margin:5px; text-align:center;">Language</h1>
				<li>English</li>
				<li>Japanese</li>
				<li>French</li>
				<li>Brazilian</li>
				<li>Chinese</li>
				<li>German</li>
				<li>Spanish</li>
			</ul>
		</div>
		<div id="content"> <!--Conteúdo Aqui-->
			<?php
				include ("connectsql.php");
				$busca = "SELECT * FROM songs WHERE id < 11";
				$result = mysqli_query($link, $busca) or die(mysqli_error());
	
				if($result){
					while($song = mysqli_fetch_assoc($result)){
						echo "<div style=font-family:calibri;color:#FFFFFF;text-shadow:1px.3px.6px;display:inline-block;width:50%;>";
						echo "<a style='text-decoration:none;color:inherit;'href=http://localhost/sitededownload/pagdownload.php>
						<h2 style= margin:0px;margin-top:10px;>$song[Song]</h2>
						</a>";
						echo "<p style= margin:0;>$song[Artista]</p>";
						echo "</div>";
					}
				}
			?>
		</div> <!--Até Aqui-->
	</body>
</html>

I want to know how I get the link word I clicked on the tag (a) inside the php and put as title on the page pagdownload.php.

How many words on the page pagdownload.php I need to make a link to a similar page, I thought to make a page only that changes according to the item that was clicked, but I do not know if it is possible.

1 answer

0


You can pass the desired word as parameter in the link and pick the pagdownload.php

echo "<a style='text-decoration:none;color:inherit;'href=http://localhost/sitededownload/pagdownload.php?title={$song[Song]}'>
    <h2 style= margin:0px;margin-top:10px;>{$song[Song]}</h2>
</a>";

And in pagdownload.php you take this parameter using the $_GET

$titulo = $_GET["title"];
  • It worked, I had no idea how to do it, thank you very much!!!!!!!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.