hi guys, need your expertise...
I'm trying to create a list for group of associates by group and when a group is selected the associates assigned to that group will appear in a list
sample -
-
<select name="groupName">
-
<?php $rs_groupSearch="SELECT * FROM tblGroup";
-
$groupCount=mysql_num_rows($rs_groupSearch);
-
if($groupCount>0){
-
while($Groups=mysql_fetch_array($rs_groupSearch)){
-
?>
-
<option><?php echo $Groups['GroupName']; ?></option>
-
<?php } else { ?>
-
<option>No Groups in List</option>
-
<?php } ?>
-
</select>
-
when user select a group then it will display the names of the selected group members (the above code works fine) -
-
<select name="groupMembers" size="4">
-
<?php $rs_groupMemberSearch="SELECT * FROM tblGroupMembers
-
WHERE GroupName='$groupName'"; //This is where i'm stuck
-
//$groupName is the name of list box above i don't know
-
//how to parse the value from that list to this sql
-
$groupMemberCount=mysql_num_rows($rs_groupMemberSearch);
-
if($groupMemberCount>0){
-
while($GroupMembers=mysql_fetch_array($rs_groupMemberSearch)){
-
?>
-
<option><?php echo $Groups['MemberName']; ?></option>
-
<?php } else { ?>
-
<option>No Members in List</option>
-
<?php } ?>
-
</select>
-
Note: I would like to do this without hitting the submit button just like how other website do their country,state drop down list. I don't mind having the list to submit itself
i have tried some examples from the net but its not working
1 3816 dlite922 1,584
Recognized Expert Top Contributor
Hey Ryangsh,
Lists don't submit themselves, lists can call javascript functions with their event handlers (onclick, onchange, onblur, so on)
So in one of these, you're list can submit the form, and therefore the list's selected value to a (php) script on the server.
The server can then know what is selected and reply back with a /new/ page (or the same page with added content), which of course this would be the name of the associates in that selected group.
This, as you may have already guessed, does a call to the server and refreshes the page, which is something you like to prevent I assume.
So the only technology that I know that can do this without refresh is called AJAX, or shortly Asynchronous Javascript.
AJAX is just fancy Javascript code that does a call to the server behind the scenes and can parse the data returned from the server. Of course the "thing" returned can't be another page, your php should as an example, return a list of names with commas in between them and NOTHING more.
This way, Javascript code can then parse the names and put them in any element on your HTML page, All in a blink of an eye!
Learn Javascrip/AJAX and forward any questions you have to the appropriate forum, If you get stuck in the PHP code, feel free to come back here.
Cheers,
Dan
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Lee Mundie |
last post by:
Hi there,
Simple problem here but can't seem to fix it!
Okay, I have a select list from which people choose avatars...
the list is option values ie. <option>Worm</option> <option>Frog</option>
etc etc and is in an include file...
where the word i.e. worm sources the image ..images/worm.gif - simple so
far...
|
by: Ryan McGeary |
last post by:
In a <select> drop-down, the onchange event isn't called when
scrolling through the dropdown using the mouse-wheel and when crossing
over a new <optgroup>.
Using the example below, notice how the onchange event isn't called
when mouse wheel scrolling between A3 and B1, but it works properly
when scrolling between A1 and A2.
E.g.
------------------------------------------
|
by: Asit |
last post by:
In JavaScripts checks for an onChange event against the value of the
textbox at the time of the last onChange event. Since an onChange
Event never fired after you changed the text first time , suppose we
put the same value in the text box then no event is fired.
If we put some other value then it became fired...
It wouldn't fire if we put the same value...
I don't want to use onBlur etc... Isthere any solution with onChange
Event...?
|
by: MDBloemker |
last post by:
can anyone help me fathom out how to use this bit of code:
Public Class Utilities
Public Shared Sub CreateConfirmBox(ByRef txt As WebControls.TextBox,
_
ByVal strMessage As String)
txt.Attributes.Add("onchange", "return confirm('" & strMessage &
"');")
End Sub
End Class
|
by: jab3 |
last post by:
Hello. I"m new to this group, and to JavaScript in general, so please
forgive me if I breach local etiquette. I'm trying to implement some
client-side 'dynamic' validation on a form. I'm having a couple of
problems, which I'll try to describe. But this e-mail will only
reproduce one of them, in a "short" example. What I'm generally doing
is having each form entry contained in a div, which as a label, an
input with some event handlers,...
| |
by: countocram |
last post by:
hi! Im having a problem retaining the inputs on my text fields. When i selected an option from a dropdown list with an onChange=location.. event. What happen is that, everytime I choose an option the page will reload then the inputs on my text field will disappear...
sample HTML:
<INPUT type="text" name="help_title" size="50">
<textarea cols="50" rows="15" name="help_content"></textarea>
<select name="main_topic"...
|
by: Leena P |
last post by:
i want to basically take some information for the product and let the user
enter the the material required to make this product
1.first page test.php
which takes product code and displays prodcut anme have used
ajax to avoid refreshing of page this works fine
2.now i have created one row with
checkbox|select box|text|text|text|text|
where in the select box values are fetched from table here also i have used ajax for getting the m_name...
|
by: robtyketto |
last post by:
Greetings,
I'm slowly building up code to do the following:-
Display TWO selection option boxes (cascading).
If the FIRST selection option box changes then reload the jsp using onchange event (not changing the option box value on relaod i.e. not re-running the SQL query).
ONLY on initial entry should the form FIRST selection option box should be populated using JDBC SQL.
|
by: ruds |
last post by:
Hello,
I have a JSP page in which HTML form elements are present.
I have a drop down list named Country, when a user selects his country
I want another drop down list to populate based on the first list the
names of coresponding states in that country.
For this I want to retrive values from database onchange event of the
first drop down list.
My code is:
<HTML>
<HEAD>
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |