Jump to content

Using dropdown as it to update record


WAMFT1
Go to solution Solved by Barand,

Recommended Posts

Hi All

 

I am trying to use a dropdown box to get 'id' from a form and use this to update a record but I can't get it to work. I know I am using old code but don't have time to update yet.

 

Any help would be appreciated.

 

FORM: 

<form action="terminate_user.php" method="post" name="aid" id="aid">
      <table width="600" border="0" class="Text_Standard">
        <tr> <td><span class="standard_left">User: </span></td> 
          <td><span class="standard_left">
            <select name="aid" class="standard_left" id="aid">
              <option value="" selected="selected"> </option>
<?php
$result = mysql_query("SELECT id, LastName, FirstName FROM `eusers` WHERE Status='CURRENT' ORDER by LastName ASC");
while ($row = mysql_fetch_array($result)){
echo '<option value="'. $row['id'] .'">'. $row['LastName'] .', '. $row['FirstName'] .'</option>';
}?> </select>
        <input type="Submit" name="Submit" id="Submit" value="Confirm and Terminate User" />
    </form>

QUERY: 

<?php
if(isset($_POST['Submit'])) { 
	$aid = ($_GET['aid']); //from form above
        $mysql_query = "UPDATE eusers SET Status='TERM' WHERE id='$aid'";
	echo "Saved!";
}?>
Edited by WAMFT1
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.