Board index   FAQ   Search  
Register  Login
Board index php forum :: Database phpMyAdmin

Dropdown box containing values from database.

How to use phpmyadmin.... phpmyadmin related arguments. Even phpMyAdmin issues

Moderators: macek, egami, gesf

Dropdown box containing values from database.

Postby chrisf2012 » Wed Feb 20, 2013 11:02 am

I am new to both MySQL and PHP so I really need help!

I have two tables 'Employee' and 'Holiday'.

in my holiday table I have the field 'employee ID' which is a foreign key from the primary key in the employee table.

I am creating a form where employees book holiday. so in the form you enter employee id, first/last name and date of holiday.

Can I have a drop down box in my holiday form for employee ID, where the values in the drop down box are the employee ID's from the employee table?

I apologise if you can not understand my explanation but I appreciate all help! Thanks
chrisf2012
New php-forum User
New php-forum User
 
Posts: 4
Joined: Wed Feb 20, 2013 10:58 am

Re: Dropdown box containing values from database.

Postby chrisf2012 » Thu Feb 21, 2013 8:25 am

anyone?
chrisf2012
New php-forum User
New php-forum User
 
Posts: 4
Joined: Wed Feb 20, 2013 10:58 am

Re: Dropdown box containing values from database.

Postby seandisanti » Fri Mar 01, 2013 12:59 pm

Sorry for the late response. Just in case you haven't gotten it sorted out yet, this one is kind of a common issue. For re-usability purposes, i typically write it into a function. Here's a quick example. adding an 'id' parameter that automatically sets an option based on a passed id is trivial, but a good idea. I'll leave that as an exercise for you.
Code: Select all

<?php
function createUserDropdown(){
    
$db=  Database::getInstance();
    
$sql "SELECT id, firstName,lastName FROM Employee";
    
$result $db->query($sql);
    if ((! 
$result)||count($result)==0){
        die(
'failed to pull employee list'.$db->error);
    }
    
$output '<select name="user"><option>Pick your name</option>';
    while (
$row $result->fetch()){
        
        
$output .= '<option value='$row['id'] . '>'$row['firstName']. ' ' $row['lastName'] .'</option>';
    }
    
$output .= '</select>';
    return 
$output;
}
 
seandisanti
php-forum Fan User
php-forum Fan User
 
Posts: 681
Joined: Mon Oct 01, 2012 12:32 pm

burberry men wallet Burberry Outlet Online Sale (3

Postby galloway8 » Tue Jun 04, 2013 1:29 pm

Payday Loans Online: Advantages
When you have to meet some urgent expenses links paying off medical bills, car repairing charges, electricity bill or an installment of an existing debt, payday loans can come in handy. If you are unable to meet burberry mens sunglasses any unexpected or unplanned expense, you should opt for payday loans online without having sunglasses burberry a second thought. These types of online payday loans have proven extremely effective for tidying over financial difficulties. What is remarkable about online payday loans is that you will not have to approach a payday loans lender for bagging it. Just forget about the hazards of interacting with a number of payday loans lenders for this purpose, you can do that easily by visiting their respective websites. So, try to utilize the power online industry for solving your financial crisis.
No matter how efficient you financial plan may be, a sudden occurrence of an unexpected expense can destabilize it anyway. In such situation, payday loans online can help you to fix your burberry womens sunglasses financial crisis effectively and without making any compromise.
Fast Processing
This is one of its vital features. Payday loans online do not take long approval time if you can provide authentic and accurate information pertaining to your financial condition and other related issues. As it is a short-term loan by nature burberry sunglasses nordstrom and as the maximum amount of loan is $1500, a lender does not burberry polarized sunglasses usually take more than 24 hours to approve an application. This is the reason why online payday loans have gained enormous popularity among salaried people.
All Time Availability
Unlike traditional loans, a borrower can apply for payday loans online from the comfort of his home of office. Just download the application form or fill up an online form with proper detail and it will be processed quickly. You can apply for online payday loans anytime from any place, which is certainly one of its unique features.
Confidential and Convenient
Do not worry about the confidentiality of your given information because you will have to furnish some basic details related to the amount of loan applied, name, contact details etc. Furthermore, most of the websites use latest encryption technologies, which is absolutely safe and secured.
Forget About the Formalities
<br burberry sunglasses uk />Payday loans online are completely free of formalities. You will not have to submit all the documents on immediate basis while applying for payday loans. You can submit them later.
Instant Cash Solution
The processing process of tradition loan is tiresome and often strenuous as it consumes much time. Now, it is not possible for a person to wait for an infinite period of time while bearing the brunt of a financial crisis. This is the reason, a large section of people have lost their interest in tradition loans and are now opting for payday loan online.
No Hassle
This is probably the best way to grab a loan without facing any hassle. No matter whether your credit report is impressive or not, you will always remain eligible for this loan. This is specialty of this loan.
/

Related articles:


burberry outlet Burberry Outlet Online Sale \(20\)

burberry mantel sale Burberry Outlet Online Sale (

burberry women jacket Burberry Outlet Online Sale
galloway8
New php-forum User
New php-forum User
 
Posts: 200
Joined: Mon Jan 07, 2013 3:36 am


Return to phpMyAdmin

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.