473,508 Members | 2,515 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

php combo box code nt working

232 New Member
my code is not working.........
[PHP]<?php

echo"<select name=$sarea >";
$option = "<option value=\"Please select a Subject Area\">Please select a Subject Area</option> \n";
for ($i = 0; $i < count($subjarea); $i++) {
$option .= "<option ";
$option .= "value=\"$subjarea[$i]\">$subjarea[$i]</option> \n";
}
echo $option;
?>

</select>

<a href="webmain.php?sarea=<?php echo $sarea; ?>">show</a>;
<br>[/PHP]
webmain.php
[PHP]$sarea=$_GET['sarea'];
echo $sarea;[/PHP]
i want to print selected subject area on webmain.php
Nov 4 '08 #1
6 4678
Dormilich
8,658 Recognized Expert Moderator Expert
first, you're missing quotation marks in line 3
second, what is $sarea? I can see it nowhere defined. If you don't get any output check the variable content with var_dump().

regards
Nov 4 '08 #2
kkshansid
232 New Member
combo box is showing data but selected data doesnot go to other page
$sarea is the name given to combo box
Nov 4 '08 #3
kkshansid
232 New Member
[PHP]my code is not working.........[/PHP]
[PHP]<?php

echo"<select name=$sarea >";
$option = "<option value=\"Please select a Subject Area\">Please select a Subject Area</option> \n";
for ($i = 0; $i < count($subjarea); $i++) {
$option .= "<option ";
$option .= "value=\"$subjarea[$i]\">$subjarea[$i]</option> \n";
}
echo $option;
?>

</select>

<a href="webmain.php?sarea=<?php echo $sarea; ?>">show</a>;
<br> [/PHP]

webmain.php
[PHP]$sarea=$_GET['sarea'];
echo $sarea; [/PHP]



cobbo box has data.combo box is working but
i want to print selected subject area on webmain.php
which is not working
i think there is error in combo box name but i am not sure what should be there plz help
Nov 4 '08 #4
Dormilich
8,658 Recognized Expert Moderator Expert
combo box is showing data but selected data doesnot go to other page
unless you post the data (via submit) your selected data will go nowhere. once your script has finished delivering the html page you can't do anything with php (including capturing user actions (like select something)) up to the next page load. so without a form you'll just pass the name, not more, not less.

regards
Nov 4 '08 #5
Dormilich
8,658 Recognized Expert Moderator Expert
please do not double post! see posting guidelines
Nov 4 '08 #6
Markus
6,050 Recognized Expert Expert
kkshansid, you have been warned a few times previously about your lack of following posting guidelines. It is in your best interest to follow them as you are teetering towards receiving a temporary ban.

Posting Guidelines - read them.
Nov 4 '08 #7

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

Similar topics

2
5433
by: Sean | last post by:
Greetings all, I am attempting to make a form that will filter through several tables that (I believe) have refretial integrity. I am pulling data from several tables into the form and i would...
4
2336
by: Mike L | last post by:
Currently, when the user presses a letter key the combo box will go to the first item in the collection of the combo box starting with that letter. For example user presses on "R", and "R2F"...
5
3682
by: jjyconsulting | last post by:
Newbie needing some help. I have a tblParticipants. The fields include gender, education_level, income, occupation etc., I'm trying to create a form where a user can run a query from the form and...
5
2205
by: consonanza | last post by:
I am working on a report filter form. It has 2 combo boxes (cmboSelectSubject and cmboSelectCategory) to select criteria. Selecting an entry in combo 1 restricts the options available in combo 2....
2
3130
by: Sid | last post by:
I need some help in setting up Access combo box. I am using three comboboxes in my form. Comb Box 1, Combo Box 2, Combo Box 3. The row source for each of the combo box is a seperate table. ...
6
3667
by: Dave | last post by:
I want to put the information that the user selects in my combo boxes into a subform that lies on the same form as the combo boxes. Thanks for your help already, Dave
2
2370
by: buddyr | last post by:
Hello, I am having trouble with two combo boxes working together. two tables table1 table2 table1 fields -number and name table 2 fields -code and number ...
2
2600
by: Dev1 | last post by:
All- I'm new to this forum and i've been working with acces for about 2 days now. I have a form in which I have two combo boxes and depending on what is selected on the first dropdown the second...
7
2525
kcdoell
by: kcdoell | last post by:
I have three tables: One for the Division location: tblDivision DivisionID = Autonumber DivisionName = Text One for the Working Region: tblWrkRegion
3
3968
kcdoell
by: kcdoell | last post by:
I have 5 cascading combo boxes on a form. Below is a sample of my vb in the first combo box: Private Sub CboDivision_AfterUpdate() 'When the Division is selected, the appropriate Segment...
0
7231
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
7405
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...
1
7066
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
7504
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
5643
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5059
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...
0
4724
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1568
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.