473,405 Members | 2,310 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,405 software developers and data experts.

how can choose SELECT tag from a form if there are multiple SELECT tags?

4
Hai all im new to this forum and begin to learn php.

Here is a problem which may be very simple to you but it is problem to me.
how can choose SELECT tag from a form if there are multiple SELECT tags?
for example
Expand|Select|Wrap|Line Numbers
  1. <form name="form" id="form" action= "page2.php">
  2.   <select name="name1" id="id1" onchange="">
  3.     <option>item1</option>
  4.   </select>
  5. <select name="name2" id="id2" onchange="">
  6.     <option>item1</option>
  7.   </select>
  8. <select name="name3" id="id3" onchange="">
  9.     <option>item1</option>
  10.   </select>
  11.  
  12. </form>
How can i select SELECT tag for ex name2 in page2.php?

Thanks for advance.
Apr 2 '08 #1
2 1474
ronverdonk
4,258 Expert 4TB
Welcome to Bytes!

Please enclose your posted code in [code] tags (See How to Ask a Question).

This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

Please use [code] tags in future.

MODERATOR
Apr 2 '08 #2
ronverdonk
4,258 Expert 4TB
Looking at your form, you can say that the form is submitted using the GET (default form option). So the values are in the $_GET array of the second script. Printing out that array you'll see the following structure
Expand|Select|Wrap|Line Numbers
  1. Array
  2. (
  3.     [name1] => item1
  4.     [name2] => item1
  5.     [name3] => item1
  6. )
So, in your "catchting" script, you test the selection of an option in the select box named name1 by verifying its presence in the $_GET array as follows:[php]if (isset($_GET['name2'])
$var_2=$_GET['name2']; // now $var_2 contains the value 'item2'[/php]And you are aware of the difference between multiple select tags, as in: multiple <select> statements and multiple-select tags, as in:multiple options in 1 select box?

Ronald
Apr 2 '08 #3

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

Similar topics

9
by: Udo Marx | last post by:
Greets to ciwah! I'm doing a little webproject for a local session event. Tryin' to meet latest standards i failed to do this: --snip-- <select name="fromcountry" accesskey="l" title="+">...
2
by: areef.islam | last post by:
Hi, I am kinda new to javascript and I am having this problem with selecting multiple options from a select tag. Hope someone can help me out here. here is my code...
0
by: sundsx | last post by:
Hi, i would sen multiple select to mysql by form, my prb is: file connect.php <?php $user="sundsx"; $pass="password"; $db="testphp"; $val_form=$_POST; $service =$_POST;
2
by: Rowan | last post by:
I have a form that has several multiple select menus. I would like to save the multiple selections but be able to show them as selected items when the form data is updated. <select...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.