Jump to content

Archived

This topic is now archived and is closed to further replies.

ivalea

Delete/Add a record with dropdown?

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!

Share this post


Link to post
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

Share this post


Link to post
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!  :)

Share this post


Link to post
Share on other sites

×

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.