SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: Dropdown code

  1. #1
    Non-Member
    Join Date
    Mar 2005
    Posts
    832
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Dropdown code

    Hi i got this form script and for permissions what is the code to have a drop down box with 2 options Administrator and Member that work?

    This is my code:

    <?
    include "theme.php";
    ?>
    <form action="addoppro.php" method="post">
    Username: <input type="text" name="username"><br>
    Permission: <input type="text" name="permission"><br>
    Operator Nickname: <input type="text" name="opnick"><br>
    <input type="Submit" value="Update">
    </form>

  2. #2
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    LOL
    Code:
    <? 
    include "theme.php"; 
    ?> 
    <form action="addoppro.php" method="post"> 
    Username: <input type="text" name="username"><br> 
    Permission: <input type="text" name="permission"><br> 
    A or M: 
    <select name="a_or_m">
    <option>Admin</option>
    <option>Member</option>
    </select>
    Operator Nickname: <input type="text" name="opnick"><br> 
    <input type="Submit" value="Update"> 
    </form>
    Mike
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  3. #3
    Non-Member
    Join Date
    Mar 2005
    Posts
    832
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    erm member works but service dosnt here is my code:

    <?
    include "theme.php";
    ?>
    <form action="addoppro.php" method="post">
    Username: <input type="text" name="username"><br>
    Permission:
    <select name="a_or_m">
    <option>service</option>
    <option>member</option>
    </select><br>
    Operator Nickname: <input type="text" name="opnick"><br>
    <input type="Submit" value="Update">
    </form>

  4. #4
    Non-Member
    Join Date
    Mar 2005
    Posts
    832
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oh i see what the problem is it dosnt add anything to the perms field this is my code, anyone knwop hwo to fix it?:
    addop.php:

    <?
    include "theme.php";
    ?>
    <form action="addoppro.php" method="post">
    Username: <input type="text" name="username"><br>
    Permission:
    <select name="a_or_m">
    <option>Member</option>
    <option>Admin</option>
    </select><br>
    Operator Nickname: <input type="text" name="opnick"><br>
    <input type="Submit" value="Update">
    </form>
    addoppro.php:

    <?
    include "../db_connect.php";
    include "theme.php";

    $perms = $_POST['perms'];
    $username=$_POST['username'];
    $onpick = $_POST['onpick'];

    $query = "UPDATE users SET username = '$username', perms = '$permission', opnick = '$opnick' WHERE username = '$username'";
    mysql_query($query);
    echo "Record Updated";
    ?>

  5. #5
    SitePoint Addict ruchit's Avatar
    Join Date
    Sep 2005
    Location
    miDDle oF NoWHere
    Posts
    222
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    addop.php
    Code:
     <?
    include "theme.php";
    ?>
    <form action="addoppro.php" method="post">
    Username: <input type="text" name="username" readonly><br>
    Permission:
    <select name="a_or_m">
    <option value="Member">Member</option>
    <option value="Admin">Admin</option>
    </select><br>
    Operator Nickname: <input type="text" name="opnick"><br>
    <input type="Submit" value="Update">
    </form>
    addoppro.php
    Code:
     <?
    include "../db_connect.php";
    include "theme.php";
    
    $permission = $_POST['a_or_m'];
    $username=$_POST['username'];
    $onpick = $_POST['onpick'];
    
    $query = "UPDATE users SET perms = '$permission', opnick = '$opnick' WHERE username = '$username'";
    mysql_query($query);
    echo "Record Updated";
    ?>
    work together - make world a better place
    Outsource to India
    Web Design India
    Affordable Webhosting


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •