Jump to content

Delete/Add a record with dropdown?


ivalea

Recommended Posts

Hello!

I have a database that includes a customers table and a students table.  In my admin I have the ability to update a customers information. 
I'm looking to include a dropdown menu on this customers page that allows me to use a dropdown to select a yes or no under a heading of student access.
Yes = delete record from students table
No = add current customer to students table

I'm not really sure on how to go about this - can someone point me in the right direction of how I could accomplish this?  Even direction of where I could find a tutorial for this specifically would greatly help! 
Thanks!
Link to comment
Share on other sites

You create a select
<form name="op" id="op" action="webpage.php" method="post">
<option name="select1" id="select1">
<select>Yes</select>
<select>No</select>
</option>
</form>

then in your php page you can read hte variables like

$select1 = $_POST['select1'];
then you can have more options on one page.
Don't forget to clean variables before messing with db
Link to comment
Share on other sites

Thanks businessman - after talking to the client, I decided instead of removing them from the table completely - which would make it more work to reinstate them - that I would just create another column in the table that either has a 1 or 0 value.  Then I just placed an update in the admin so that it updates this field through a dropdown.  This allows the admin then to turn the student off or on.  Students only gain access to their pages if this active column is set to 1. Works great!
Thanks again for the speedy response though!  :)
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.