473,387 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to use the values selected in a drop down list to be processed?

im working on a php program that stores basketball team on a database, then i will use 2 drop down list to select the two teams that will have a match. The drop down list already work and fetch list of teams, my problem is that i dont know how to use their value to be used in the next form..

i have uploaded my match creation form image, the one with the select team,
i want that when i press start button, their values will be use in the next form, the one with team +1 +2 +3 for processing..

i use mysql as database
Attached Images
File Type: jpg 1.jpg (8.6 KB, 215 views)
File Type: jpg 2.jpg (14.0 KB, 172 views)
Feb 5 '11 #1
4 2706
HaLo2FrEeEk
404 256MB
You need to put the dropdown lists in a form, give them each a unique id attribute, then set the form's action attribute to the page where you want to submit the form to. On that page you need to read the $_POST array. If you give one of your dropdown boxes an id of "dropdown1", then the corresponding value in the POST array would be:

$_POST['dropdown1'];

This doesn't work if you don't give your option tags value attribute with whatever you want to send to the submission page.
Feb 6 '11 #2
im using sql as the database, where will i insert the $_POST['dropdown']??
Feb 6 '11 #3
HaLo2FrEeEk
404 256MB
You don't insert it anywhere, you use it in your php code. Quick example:

form:
Expand|Select|Wrap|Line Numbers
  1. <form action="submit.php" method="post">
  2. <select name="dropdown" id="dropdown">
  3. <option value="1">Option 1</option>
  4. <option value="2">Option 2</option>
  5. <option value="3">Option 3</option>
  6. <input type="submit" value="Submit">
  7. </form>
submit.php
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $option = $_POST['dropdown'];
  3. ?>
Of course, this isn't complete code, but you should see what's happening here. The form submits to submit.php using POST. submit.php gets whatever value was selected in the dropdown menu (which has an id of "dropdown") using the POST array.
Feb 7 '11 #4
it's working now..datas from database are now populating my drop down list..i also manage to fetch it's data to be processed..

thanks a lot..


:D
Feb 7 '11 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: marx | last post by:
I have a bit of a problem and any help would be much appreciated. Problem: I have two dropdown list boxes with same data(all data driven). These are used for two separate entries. For every...
2
by: Benny | last post by:
Hello Experts, I have a drop down list web control in one of my page. Currently if I want to expand the drop down list to show all items, I must click on the down-arrow sign on the right hand...
4
by: charliewest | last post by:
I need to set the selected drop down list value at run time. I am aware of the method "SelectIndex" however this works only if you know the precise location of the value within the ListItem...
3
by: Stephen Adam | last post by:
Hi there, I'm sure i'm missing something really simple here, all i want to do is get the value of the selected item in a list box. Even after much fiddling about last night I still could not get...
2
by: kavi | last post by:
Can anyone send me the script for supplying the values in drop down list of the web page? I have couple of drop down list controls in my web page. I need to supply multiple values for each...
1
by: puja | last post by:
hi all, I have a requirement where I need to populate drop down list (which is not run at server control. i.e it is an html control ) using server side code in C#? How can I add option values...
1
by: anniyan1981 | last post by:
Need help very Urgent. I need to know how to select all the values in the Drop Down list by clciking a button. Please help me...
1
by: antony78 | last post by:
Hi, Could you please tell me how to retrieve the values in the select tag of HTML using JSP. eg: <select name="", id="",> <option value="1">1</option> </select>. I want to retrieve the...
2
by: crazychrisy54 | last post by:
Hi there I have a option, select drop down list which a user can open. My page however refreshes very frequently and when this occurs the selected drop down list will pop back up. The user then...
2
by: ndeeley | last post by:
Hello, I've written a script which returns the admin rights of users in a table - their access level, and their priviledges. The priviledge are returned to a check box and the admin rights to a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.