Connecting Fields In Access Via Selected Drop Down Menu?

i am new to PHP and finding it interesting difficult at the same time. I need to connect to an access database depending on the selected menus in the drop down box and printing the selected field in a table.
Here is my code

$ch1 = 'unchecked';
$ch2 = 'unchecked';
$ch3 = 'unchecked';
$ch4 = 'unchecked';
$ch5 = 'unchecked';



Selected Value In Drop Down Menu

I want the first option ("selected" option) in a drop down menu to be based on the URL a user clicks on. For example, if the user clicks on the link:


The first and selected value in the drop down menu should be abstract
Then the rest of the menu will pull from the database.

The code I am using now (below) lists all my categories from my database, but it is not putting the selected value first. How can I get this to work?? Code:

View 1 Replies View Related

Showing What Was Selected In Drop-down Menu

I'm trying to create a form where the user inputs data, i validate it with php, and if some of the input is missing or invalid then i print out errors with the form filled out with the information they entered/selected previously so they can change/add to it.

The problem I'm having is setting my drop down menus to be selected when the form is returned instead of returning their original state. The menu I have is named A ($A). Here's an example of what I'm doing that isn't working: PHP Code:

View 2 Replies View Related

SQL Query Selected From A Drop Down Menu

I've got the following query which gets values $search and $furn from a form.

SELECT * FROM properties WHERE description LIKE '%$search%' AND furniture='$furn' ORDER BY id ASC LIMIT $start, $display"

This works almost fine. The only problem is that because $furn value is either 'yes' or 'no', selected from a drop down menu, sometimes when is not selected the query doesn't work. Code:

View 2 Replies View Related

Using Variables To Control What Is Selected In An Drop-down Menu?

I have a drop-down menu with the states. I don't necessarily want to have the menu dynamic with a database, but I want to be able to control what is selected using a variable. Code:

<select name=state id=state>
<option value="" selected>--</option>
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>

View 3 Replies View Related

Show The Drop Down Menu With The Selected Options?

First, I am building a form with multiple drop down boxes. The options of the second drop down box will depend on what the user chooses on the first, options of the third drop down box depend on what they choose on the second, etc. The values of each option are inside a database which I can query for and put into a php array.

Second, when this form is completed, it should be viewable/editable by the user so it should be able to show the drop down menu with the selected options that the user chose. How would I be able to set the certain options for the drop down box to what the user chose and be able to make it dynamic again so they can make changes to what they chose.

View 3 Replies View Related

Drop Down Menu Selected Using Session Variable?

I am trying to get my drop down menu to use a session variable as the selected menu option. Here's my code:

echo "<option value="">Delivery Area</option>";
$selected = "";
if(isset($_SESSION['postal_area']) && $_SESSION['postal_area'] == "England") {
$selected = "selected";
} elseif(isset($_SESSION['postal_area']) && $_SESSION['postal_area'] == "Wales") {


View 1 Replies View Related

Drop Down Menu - Every A Value Of It Is Selected To Reload The Page And Submit That Value.

i have a drop down menu and i want every a value of it is selected to reload the page and submit that value. i'm using something like this: HTML Code:

<select name="menu">
<option selected value="1">GENERAL</option>
while ($cat = mysql_fetch_array($q)) {
$cid = $cat[0];
$cname = $cat[1];
echo "<option value='$cid'>$cname</option>

echo "</select>";

i tried using <select name="c" size="1" onChange="MM_jumpMenu('parent',this,0)"> but i got confused so i'm looking for an alternative way..

View 3 Replies View Related

Assign Selected In Drop Menu Box From 2 Tables (joint)

3 tables : one events table (each event can have differents types) one types table (each type can have differents events) and one liaison table (link between events and types tables)

I have some problems when I show screen.

<select name="type[]" size="10" multiple="multiple">
$req_type = "SELECT * FROM type ORDER BY type ASC";
$res_type = mysql_query($req_type);


The selected don't run and don't show correct value.

View 5 Replies View Related

Display Previous Selected Option From Drop Menu?

I have a drop menu as below and when submitted it sends either no value, male or female to the database.

<select id="gender" name="gender">
<option selected="selected" value=""/> </option>
<option value="Male">Male</option>
<option value="Female">Female</option>

Now when i go back to the page i want it to show the value that was previously selected/stored in database.Basically the php code i have at the moment is to get the values and it sends to database. I already have a while loop so all i need to do is $row[gender] to get get value but how i implement it into the drop menu html code i don't know.

View 3 Replies View Related

Fill Textfield With Selected Option From Drop Down Menu?

I have one drop down menu and one textfield. The drop down menu will display the book's id and book's name that retrieve from the database while the textfield will automatically display the book's name based on the user selection from the drop down menu. I try to use the javascript function to do this but since the value for the option is book's id so the textfield is displayed the book's id but not the book's name. What should I do so that the textfield will display the book's name? Below are parts of the code.

<?php $sql = "SELECT * FROM store ORDER BY book_id";
$result = mysql_query($sql);
<select name="book_id" id="book_id" class="font" onChange="updateText();"><option value=""></option>
<?php while($row = mysql_fetch_array($result))


View 5 Replies View Related

Update User Selected Drop Down Menu Value To Database?

Heres my page I have a table with rows of ID and its status. Status is a drop down menu with 4 possible options. The default displayed is the value from database. When the user picks a value form drop down menu say "completed" I want this value to be updated fro that particular id to database.

Heres my script to create drop down:



This drop down is for each row of the status column. When The user clicks submit by choosing some status value . I receive it in the same page using post.


But when I use update I need to use something like this

"Update TABLE set COLUMN = 'progress' where ID = $id";

But How DO I remember the ID???Can I pass the ID through Post/select too?

View 4 Replies View Related

Enable / Disable Of Textbox On Option Selected From Drop Down Menu?

What I want is that the text box is only accessible if a certain option is picked from the drop down menu and i have a html form as below:

a.Did any of your staff participate in training or orientation sessions related to any aspect of social performance management, during the reporting year?

No, but planning in future

if not,and not planning explain why not

Now when a user selects the option No, but planning in future then the text box must be enabled otherwise the textbox must be disabled

View 2 Replies View Related

Unable To Store Selected Fields From Drop Downlist To Variables

Not able to store multiple fields selected from drop down lists in form to variables in php using GET syntax. I am doing a search query list data in field based on the selection.

My Code;

The code is as below;

HTML Form;

<form action="search3.php" method="GET">


View 1 Replies View Related

Populate A Drop Down Menu That Holds The Fields Of A Database?

i am currently trying to populate a a drop down menu that holds the fields of a database, the code i am using is a follows,

PHP Code:

<select name="existing"><option>Select One</option><?php // Retrieve all the categories and add to the pull-down menu.$query = mysqli_query("SELECT category_id, category_name FROM category ORDER BY category_name ASC", $dbc) ;$result = mysqli_query ($dbc, $query);while ($row = mysqli_fetch_array ($result)) {echo "<option value="{$row[category_id]}">{$row[category_name]}</option>
";}mysqli_close($dbc); // Close the database connection.?>

I cannot see the problem however when i do or die i get an error saying there is a parse error and unexpected '?' what ever that means?

The main problem how ever is that the menu is not populating.

View 5 Replies View Related

Drop Down Menu Select And Populating Data Fields

I have a PHP/MySQL Content Management System set up for the job I work at. It's basically a shift program that lets users pick up shifts, post shifts, etc.

The data fields are tied to the shift ID which is selected from a dynamically populated drop down box. However, I cannot get the data fields to be updated when I select a new value and I cannot get the form to accept the new selected Shift ID. I have tried using JavaScript but cannot quite get it to work. Code:

View 1 Replies View Related

Pulling Several Fields From A Table And Displaying Them All In One Drop Down Menu?

pulling several fields from a table and displaying them all in one drop down menu for people to select one of them. I dont know what this is called to I dont know what to research online.

View 1 Replies View Related

Trying To Access A Table In My Database With A Drop-down Menu

I'm trying to write a form to enter "news" or blog updates. I want to be able to have a drop-down list with all the categories, but for the purposes of keeping things consistent, I was going to have a seperate table for categories (with an id #, cat. name, and cat. description).

This way, I can also have an archive page listed by category. How can I write a "new entry" form with a drop-down list that uses the categories from the category table (and, should I ever add a new category, have it automatically update the drop-down list)? Code:

View 1 Replies View Related

Populate A "Select" Box Drop Down Menu In A Form With Database Fields?

I am currently creating a form and I want to populate a drop down selection menu with data from two fields in a form. For example, I want it to pull the first and last name fields from a database to populate names in a drop down menu in a form. I want the form to submit to the email address of the person selected in the drop down. Is this possible to do? The email is already a field in the record of the person in the database.

how I should go about setting up the "Select" box drop down? I am not sure how to code it to do what I am wanting.

View 10 Replies View Related

Make The Parent Menu Get Selected In Multi Level Menu?

How to make the parent menu get selected in multi level menu.For example we have following multilevel menu:

- Menu2.1


View 2 Replies View Related

How Do I Change The Drop Down List So The Option Selected Last Time Is Then The Current One Shown In The Drop Down Box?

I have a drop down list with the town options 'Bury' and 'Ipswich' as
shown below.

When selecting one of the options, its value is passed to variable

How do I change the drop down list so the option selected last time is
then the current one shown in the drop down box?


<?php $townsearch = $_get['town']; ?>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get">

<select size="1" name="town">


<input type="submit" value="GO" />


View 12 Replies View Related

Position A Element (drop Down Menu Item) Exactly Below The Parent Menu?

I am trying to place a dropdown menu item below the parent menu. When u hover on the parent menu, the child dropdown menu item's visibility will turn visible. I positioned the child elements using position:absolute and using top and left. But when i change the resolution of the monitor the left and top alignment changes How to position that element.

View 2 Replies View Related

Retain Drop Down Selected Values / When Submit Is Clicked Selected Values Are Return To Defaults?

I have several drop down boxes. When submit is clicked it execute query on another page. Problem is when submit is clicked selected values are return to defaults. Is it possible for the values to be remembered after submitting them? Part of the drop down code:

[Select] <?php

View 5 Replies View Related

Connecting To Access Db

i was working with asp but the site is launched in linux server.had to switch to php.
i had a access db admin.mdb i need to connect to admin.mdb and insert and retrieve data from it.

View 1 Replies View Related

Selected In A Drop Down

I have two drop down menus. First one is location. When you change location page refreshes and comes with the selected area. So with the refresh,the second drop down changes to the sub-locations of the selected location. For example: Here is my code:

if ( ! isset($location) ) {
@mysql_connect ( "localhost", "root", "passwd" ) || die ("MySQL'e baglanamadim");
mysql_select_db ( "ceyhun" ) || die ("Veritabanýný seçemedim");
$sorgu=mysql_query("Select *from locations");
$sorgu2=mysql_query("Select *from sublocations where Location='$location'");

View 2 Replies View Related

Selected Value In Drop Down?

I am using this code to populate a drop down list from mysql database.I need to pass id and name through this code.but the problem is the value is lost when the page gets refreshed.and it works fine if i pass only name through code is as follows:

PHP Code:


View 14 Replies View Related

Jump Menu Selected Value

I have a set of 2 menus where the values of the 2nd are dependent on the value selected in the first. Yes, I will (eventually) convert this to a javascript process, but for now I am content reloading the page.

I have created a jumpmenu that reloads the page with the state passed in the url (ie. community.php?state=NY). This determines the values displayed in a second (dependent) menu which then lists the counties available for that state. Code:

View 1 Replies View Related

Cannot Setting The Selected Value From The Menu?

i'm using a select statement and its not setting the selected value from the menu.i've tried to echo the id for the selected item but its just coming back as the first record in the list.i.e. menu - resume - - calendar - - phone book -when i select calendar it still show record set resume was selected.


View 2 Replies View Related

Figure Out With Connecting To DB And Send Mail To Users Based On A Drop Down Group Selection?

I have a form that I am trying to get figured out with connecting to the DB and send mail to users based on a drop down "group" selection. Then once I select the group I am trying to figure out how to populate the "who" drop down which will contain an "all" option along with the names of all the people in the selected group. Once the group is selected and the person, or "all", then I need the form to send the email to all the email addresses associated with the selected group and users. This is my form so far. I know its not much yet but what I am looking to do, I have never done before.


View 2 Replies View Related

Connecting To AMicrosoft Access DB

For a school project, i'm going to be using a Microsoft Access Database as my database and PHP as the code the code my application. I was wondering how to connect to a Microsoft Access Database?

View 1 Replies View Related

Connecting To An MS Access Database

I'm working on a site that was written by somebody else using asp in conjunction with an access database. I prefer PHP so am converting it to PHP but retaining the access database. Code:

View 1 Replies View Related

Copyrights 2005-15, All rights reserved