Jump to content

[SOLVED] pulling value


dare87

Recommended Posts

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>

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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>";}
?>

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.