Jump to content

mysql php display column in dropdown?


marksie1988

Recommended Posts

ok i got the dropdown working by using the following code

 

<?php
  $res = mysql_query("SELECT * FROM songs ORDER BY title")
      or die("Invalid query: " . mysql_query());
  echo '<label>Select value:</label>';
  echo '<select id="song" name="song">';
  echo '<option value="">Select</option>';
  while ($row = mysql_fetch_assoc($res)) {
     $va = $row['title'];
     echo "<option value='$va'>$va</option>";
  }
  echo '</select>';
?>

 

but how could i use this so that when an admin selects a song title they can view lyrics to edit them ? (lyrics column is called lyrics)

Link to comment
Share on other sites

would it be possible to select the song title from the dropdown and then on select get the id and go to an edit page edit_song.php?id=23

 

then when the fields are changed and submit is selected it will update the row with id 23

 

 

i think this should be possible but i dont know much about dropdown menu's so i wouldnt know how to tell it to get the id and then go to the edit page

 

please help

 

i really need this now

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.