ashrobbins87 Posted March 15, 2009 Share Posted March 15, 2009 I am making a page for user management, and part of it is letting the person using it view a drop down list of current users, then when they have chosen one they click 'View' to view the details in a pop up window. Trouble is, I cant get it to work. The code I'm working with is below... $getUsers_sql ="SELECT id, firstname, surname FROM cms_users ORDER BY firstname"; $getUsers_res = mysqli_query($mysqli, $getUsers_sql)or die(mysqli_error()); echo '<select name="users">'; while ($row = mysqli_fetch_assoc($getUsers_res)) { echo '<option value="' . $row['id'] . '">' . $row['firstname'] . ' ' . $row['surname'] . '</option>'; } echo "</select>"; $f = $row['firstname']; $s = $row['surname']; echo" <a href=\"javascript:eventWindow('user.php?f=".$f."&s=".$s."');\"> <input type=\"submit\" name=\"viewuser\" value=\"View\" /> </a>"; I know the query is right, but when I hover over the View button when I'm testing, it says the fields are empty. Link to comment https://forums.phpfreaks.com/topic/149564-populate-pop-up-box-with-data-from-drop-down-field/ Share on other sites More sharing options...
ashrobbins87 Posted March 15, 2009 Author Share Posted March 15, 2009 Ok I've changed it to ... $getUsers_sql ="SELECT id, firstname, surname FROM cms_users ORDER BY firstname"; $getUsers_res = mysqli_query($mysqli, $getUsers_sql)or die(mysqli_error()); echo '<select name="users">'; while ($row = mysqli_fetch_assoc($getUsers_res)) { echo '<option value="' . $row['id'] . '">' . $row['firstname'] . ' ' . $row['surname'] . '</option>'; $f = $row['firstname']; $s = $row['surname']; } echo "</select>"; echo" <a href=\"javascript:eventWindow('user.php?f=".$f."&s=".$s."');\"> <input type=\"submit\" name=\"viewuser\" value=\"View\" /> </a>"; ...so now at least it shows that there is something in the variables when I hover over the "View" button. But it always goes to the last record, not the record selected in the drop down. Any clues?? Link to comment https://forums.phpfreaks.com/topic/149564-populate-pop-up-box-with-data-from-drop-down-field/#findComment-785469 Share on other sites More sharing options...
ashrobbins87 Posted March 16, 2009 Author Share Posted March 16, 2009 anybody have any ideas??? Link to comment https://forums.phpfreaks.com/topic/149564-populate-pop-up-box-with-data-from-drop-down-field/#findComment-785672 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.