Transmission of the form



  • There's a list of music genres, depending on the tight button, the music of a certain genre is coming out, but since the genre is a lot, I don't want to write a sample for every genre. Maybe you can give the shape name to the processor and then compare the name to the genre in the table and remove it?

    Here's a couple of shapes:

    <form method="POST" action="music.php">
    <input type = "submit" name="soul" value="Soul">
    </form>
    <br>
    <form method="POST" action="music.php">
    <input type = "submit" name="vokal" value="Вокальная">
    </form>
    <br>
    <form method="POST" action="music.php">
    <input type = "submit" name="jaz" value="Джаз">
    </form>
    

    if(isset($_POST['bluz'])) {
    $result = mysql_query("SELECT * FROM music WHERE Жанр = 'bluz' ");
    while($row = mysql_fetch_array($result)){
    if ($row['Ссылка'] != ""&&file_exists("music/".$row['Ссылка']))
    {
    $muz='music/'.$row['Ссылка'];

    echo'<div id="spisok_pesen"><ul><li><h3>'.$row['Название'].'</h3><audio src='.$muz.' controls></audio></li></ul></div>';
    }}}
    if(isset($_POST['heavy'])) {
    $result = mysql_query("SELECT * FROM music WHERE Жанр = 'heavy' ");
    while($row = mysql_fetch_array($result)){
    if ($row['Ссылка'] != ""&&file_exists("music/".$row['Ссылка']))
    {
    $muz='music/'.$row['Ссылка'];

    echo'<div id="spisok_pesen"><ul><li><h3>'.$row['Название'].'</h3><audio src='.$muz.' controls></audio><p><a href="'.$muz.'" download><br>Скачат</a></li></ul></div>';
    }}}



  • <?php
    mysql_query ("set_client='utf8'"); 
    mysql_query ("set character_set_results='utf8'"); 
    mysql_query ("set collation_connection='utf8_general_ci'"); 
    mysql_query ("SET NAMES utf8"); 
    ini_set('display_errors','On'); 
    error_reporting(E_ALL|E_STRICT); 
    $db="syte"; 
    $connect = mysql_connect("localhost", "root", "")or die; 
    mysql_select_db($db);
    $genre = mysql_query("SELECT `Жанр` FROM `music`");
    while($row = mysql_fetch_array($genre)){
        echo '<div id="spisok_janrov">
     <form method="POST" action="music.php">
            <input type="submit" name="'.$row['Жанр']. '" value="'.$row['Жанр'].'" />
        </form>
        <br />
    </td>
    </div>';
    }
    ?>
    

Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2