|
| |
|
|
kelsey720
Posts: 6 Joined: 7/12/2009 Status: offline
|
Swtiching Databases - 7/12/2009 10:37:22
Hello, I'm using Dreamweaver with PHP and MySQL. I'm creating a webpage where I have a form and two radio buttons called 'students' and 'teachers'. What I want to have is if someone were to click on student and fill in the form and hit submit, the data would go directly into the student database. On the other hand, if someone were to click teachers and fill in the form and hit submit, the data would go to the teachers database. The catch is I want this to occur all on the same page without having to load two different pages with the exact same form. Any ideas? Thanks, Kelsey
|
|
|
|
ou812
Posts: 1705 Joined: 1/5/2002 From: San Diego Status: offline
|
RE: Swtiching Databases - 7/12/2009 12:18:43
First, I'm guessing you really mean table and not database? To me this may be more of a design issue. Why not write to the same table, since all of the information is going to be the same, and then just have a column that determines if they are a teacher or student.
_____________________________
-brian Black Holes suck. EnterpriseDB: Enterprise-class relational database management system PostgreSQL: The world's most advanced open source database
|
|
|
|
kelsey720
Posts: 6 Joined: 7/12/2009 Status: offline
|
RE: Swtiching Databases - 7/12/2009 13:20:43
I understand what you mean but I have another issue. I believe I did mean to say table and I will need to draw data from different tables within a database by using the two radio buttons. So when a student or teacher logs in, I want them to be taken to a different page depending on whether they are a student or a teacher. My login form is created the same way so if they choose student or teacher and type in their email and password and login they will be taken to different pages depending on what they are. Also, the database is going to contain a lot of users and I would like to keep the students and teachers separate so it is easier to manage. Sorry but I am new to PHP and MySQL and am learning.
|
|
|
|
ou812
Posts: 1705 Joined: 1/5/2002 From: San Diego Status: offline
|
RE: Swtiching Databases - 7/12/2009 14:18:19
If you need to keep them in separate tables, just use an if/then statement in your page to check the value of the radio button when writing to the DB to figure out which routine/sql to use. http://www.w3schools.com/php/php_if_else.asp
_____________________________
-brian Black Holes suck. EnterpriseDB: Enterprise-class relational database management system PostgreSQL: The world's most advanced open source database
|
|
|
|
kelsey720
Posts: 6 Joined: 7/12/2009 Status: offline
|
RE: Swtiching Databases - 7/12/2009 14:20:28
Ok. Thanks for the help. That's what I need. I've done some work with if..then statements so I'm sure it shouldn't take too long to figure out. Thanks again.
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|