dare87 Posted March 21, 2008 Share Posted March 21, 2008 I have an edit page that I am trying to make pull the default selection but I am a little lost. I know that I need to do a $_GET['level'] but I don't know how/where to do it. Here is what I have. Being passed on the URL http://www.domain.com/team_edit.php?name=Bob%20Dole&title=Team%20Manager&id=10&level=1 On the page <tr> <td>Access Level:</td> <td> <select name="access" class="required"> <option value="2">Officer</option> <option value="1">Manager</option> <option value="3">Other</option> </select> </td> </tr> Quote Link to comment https://forums.phpfreaks.com/topic/97189-solved-pulling-value/ Share on other sites More sharing options...
Lamez Posted March 21, 2008 Share Posted March 21, 2008 <?php $lvl = $_GET['level']; echo $lvl; ?> output: 1 any help? Quote Link to comment https://forums.phpfreaks.com/topic/97189-solved-pulling-value/#findComment-497330 Share on other sites More sharing options...
dare87 Posted March 21, 2008 Author Share Posted March 21, 2008 not really, but thanks Quote Link to comment https://forums.phpfreaks.com/topic/97189-solved-pulling-value/#findComment-497331 Share on other sites More sharing options...
Lamez Posted March 21, 2008 Share Posted March 21, 2008 could you rephrase the question. are you asking how to get a page depending on what is sent through the drop down box? Quote Link to comment https://forums.phpfreaks.com/topic/97189-solved-pulling-value/#findComment-497333 Share on other sites More sharing options...
dare87 Posted March 21, 2008 Author Share Posted March 21, 2008 I have a team_review page that lists everyone from a database. Next to there name is a delete and edit button. When you click edit, this information is passed to the url and it opens the team_edit page. http://www.domain.com/team_edit.php?name=Bob%20Dole&title=Officer&id=12&level=2 On the edit page it has fields that can be edited. aka Name Title Phone Email Leve The Level is a <select> with three options <option value="2">Officer</option> <option value="1">Manager</option> <option value="3">Other</option> What I want it to do is when they/I click edit for it to auto select the option depending on the value... in this case 2... selected Quote Link to comment https://forums.phpfreaks.com/topic/97189-solved-pulling-value/#findComment-497334 Share on other sites More sharing options...
dare87 Posted March 21, 2008 Author Share Posted March 21, 2008 does that make sense? Quote Link to comment https://forums.phpfreaks.com/topic/97189-solved-pulling-value/#findComment-497343 Share on other sites More sharing options...
Lamez Posted March 21, 2008 Share Posted March 21, 2008 kinda, what about a IF statment? if ($lvl == ('1')){ do somthing } Quote Link to comment https://forums.phpfreaks.com/topic/97189-solved-pulling-value/#findComment-497345 Share on other sites More sharing options...
dare87 Posted March 21, 2008 Author Share Posted March 21, 2008 It didn't like this <?php echo "<option value=\"2\""; if($_GET['level'] == 2){echo " selected ";} echo ">"Officer"</option>";} else if if($_GET['level'] == 1){echo " selected ";} echo ">"Manager"</option>";} else if($_GET['level'] == 3){echo " selected ";} echo ">"Other"</option>";} ?> Quote Link to comment https://forums.phpfreaks.com/topic/97189-solved-pulling-value/#findComment-497349 Share on other sites More sharing options...
Lamez Posted March 21, 2008 Share Posted March 21, 2008 why, if it works, then use it. Quote Link to comment https://forums.phpfreaks.com/topic/97189-solved-pulling-value/#findComment-497350 Share on other sites More sharing options...
dare87 Posted March 21, 2008 Author Share Posted March 21, 2008 it didn't work Quote Link to comment https://forums.phpfreaks.com/topic/97189-solved-pulling-value/#findComment-497351 Share on other sites More sharing options...
dare87 Posted March 21, 2008 Author Share Posted March 21, 2008 Any Other Ideas? Quote Link to comment https://forums.phpfreaks.com/topic/97189-solved-pulling-value/#findComment-497598 Share on other sites More sharing options...
rhodesa Posted March 21, 2008 Share Posted March 21, 2008 Try this: <option value="2">Officer</option> <option value="1"<?php if($_GET['level'] == '1') echo " selected";?>>Manager</option> <option value="3"<?php if($_GET['level'] == '3') echo " selected";?>>Other</option> Quote Link to comment https://forums.phpfreaks.com/topic/97189-solved-pulling-value/#findComment-497602 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.