Hi Php users,
I have a form that has two (has more but for sake of brevity I am assuming
it to be two) dropdown menu.
menu 1: select organism.
menu 2: select genome. This menu depends on the selected value in the first
menu. It query into database and populate the result in this menu.
Once both are selected, I want a submit button that takes me to another page
where I can process these values to perform some specific task on the
database.
I am using the following form tag
'processForm.php' >
I have the following problem now:
1. If I keep the action value in the form tag above, after selecting the
first option it direct me to the second page and I am not able to select the
seconf option in the form.
2. If I remove the action value above then I can not submit the form as
intended.
3. If I remove the "onChange="autoSubmit();"" from select tag then I am not
able to pass the selected value in first option to mysql to get the result.
I think I reached a place from where it is not possible for me to proceed
ahead. I may need to change something which I am not aware of.
Help needed.
Thanks
[php]
include'login.php';
$conn = mysql_connect($db_hostname, $db_username, $db_password );
$db = mysql_select_db('rugit',$conn);
if (!$db) die("Unable to connect to MySQL: " . mysql_error());
?>
not an expert but from some things that I've done...
When you handle the selection use JS and set a hidden field on your form
wiht the choice. Do the same with your second dropdown and then let them
click on a 'submit'
"Fahim Mohammad" wrote in message
news:BANLkTim47cjrUsXYz=t-Yfhaoz_iUntesA@mail.gmail.com...
> Hi Php users,
> I have a form that has two (has more but for sake of brevity I am assuming
> it to be two) dropdown menu.
>
> menu 1: select organism.
>
> menu 2: select genome. This menu depends on the selected value in the
> first
> menu. It query into database and populate the result in this menu.
>
> Once both are selected, I want a submit button that takes me to another
> page
> where I can process these values to perform some specific task on the
> database.
>
> I am using the following form tag
>
>
> 'processForm.php' >
>
> I have the following problem now:
>
> 1. If I keep the action value in the form tag above, after selecting the
> first option it direct me to the second page and I am not able to select
> the
> seconf option in the form.
>
>
> 2. If I remove the action value above then I can not submit the form as
> intended.
>
> 3. If I remove the "onChange="autoSubmit();"" from select tag then I am
> not
> able to pass the selected value in first option to mysql to get the
> result.
>
> I think I reached a place from where it is not possible for me to proceed
> ahead. I may need to change something which I am not aware of.
>
> Help needed.
> Thanks
>
> [php]
>
> include'login.php';
> $conn = mysql_connect($db_hostname, $db_username, $db_password );
> $db = mysql_select_db('rugit',$conn);
> if (!$db) die("Unable to connect to MySQL: " . mysql_error());
> ?>
>
>
> $organism = $genomeVer = null; //declare vars
> if(isset($_GET["organism"]) && is_string($_GET["organism"]))
> {
> $organism = $_GET["organism"];
> }
> if(isset($_GET["genomeVer"]) && is_string($_GET["genomeVer"]))
> {
> $genomeVer = $_GET["genomeVer"];
> }
> ?>
>
>
>
>
>
>
> [/php]
>
>
> --
> Fahim
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: Dynamic dropdown: where am I wrong?
am 25.05.2011 05:55:19 von Karl DeSaulniers
You could try using Ajax to get the field values from your database.
And you wouldn't have to refresh the page.
jQuery ajax does a nice job of this.
HTH,
Karl
On May 24, 2011, at 10:27 PM, Jim Giner wrote:
> not an expert but from some things that I've done...
> When you handle the selection use JS and set a hidden field on your
> form
> wiht the choice. Do the same with your second dropdown and then
> let them
> click on a 'submit'
> "Fahim Mohammad" wrote in message
> news:BANLkTim47cjrUsXYz=t-Yfhaoz_iUntesA@mail.gmail.com...
>> Hi Php users,
>> I have a form that has two (has more but for sake of brevity I am
>> assuming
>> it to be two) dropdown menu.
>>
>> menu 1: select organism.
>>
>> menu 2: select genome. This menu depends on the selected value in the
>> first
>> menu. It query into database and populate the result in this menu.
>>
>> Once both are selected, I want a submit button that takes me to
>> another
>> page
>> where I can process these values to perform some specific task on the
>> database.
>>
>> I am using the following form tag
>>
>>
>> action =
>> 'processForm.php' >
>>
>> I have the following problem now:
>>
>> 1. If I keep the action value in the form tag above, after
>> selecting the
>> first option it direct me to the second page and I am not able to
>> select
>> the
>> seconf option in the form.
>>
>>
>> 2. If I remove the action value above then I can not submit the
>> form as
>> intended.
>>
>> 3. If I remove the "onChange="autoSubmit();"" from select tag
>> then I am
>> not
>> able to pass the selected value in first option to mysql to get the
>> result.
>>
>> I think I reached a place from where it is not possible for me to
>> proceed
>> ahead. I may need to change something which I am not aware of.
>>
>> Help needed.
>> Thanks
>>
>> [php]
>>
>> include'login.php';
>> $conn = mysql_connect($db_hostname, $db_username, $db_password );
>> $db = mysql_select_db('rugit',$conn);
>> if (!$db) die("Unable to connect to MySQL: " . mysql_error());
>> ?>
>>
>>
>> $organism = $genomeVer = null; //declare vars
>> if(isset($_GET["organism"]) && is_string($_GET["organism"]))
>> {
>> $organism = $_GET["organism"];
>> }
>> if(isset($_GET["genomeVer"]) && is_string($_GET["genomeVer"]))
>> {
>> $genomeVer = $_GET["genomeVer"];
>> }
>> ?>
>>
>>
>>
>>
>>
>>
>> [/php]
>>
>>
>> --
>> Fahim
>>
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
Karl DeSaulniers
Design Drumm
http://designdrumm.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: Dynamic dropdown: where am I wrong?
am 25.05.2011 13:15:05 von Phpster
On 2011-05-24, at 11:55 PM, Karl DeSaulniers wrote:
> You could try using Ajax to get the field values from your database.
> And you wouldn't have to refresh the page.
> jQuery ajax does a nice job of this.
>=20
> HTH,
>=20
> Karl
>=20
> On May 24, 2011, at 10:27 PM, Jim Giner wrote:
>=20
>> not an expert but from some things that I've done...
>> When you handle the selection use JS and set a hidden field on your form
>> wiht the choice. Do the same with your second dropdown and then let them=
>> click on a 'submit'
>> "Fahim Mohammad" wrote in message
>> news:BANLkTim47cjrUsXYz=3Dt-Yfhaoz_iUntesA@mail.gmail.com...
>>> Hi Php users,
>>> I have a form that has two (has more but for sake of brevity I am assumi=
ng
>>> it to be two) dropdown menu.
>>>=20
>>> menu 1: select organism.
>>>=20
>>> menu 2: select genome. This menu depends on the selected value in the
>>> first
>>> menu. It query into database and populate the result in this menu.
>>>=20
>>> Once both are selected, I want a submit button that takes me to another
>>> page
>>> where I can process these values to perform some specific task on the
>>> database.
>>>=20
>>> I am using the following form tag
>>>=20
>>>
tion =3D
>>> 'processForm.php' >
>>>=20
>>> I have the following problem now:
>>>=20
>>> 1. If I keep the action value in the form tag above, after selecting the=
>>> first option it direct me to the second page and I am not able to select=
>>> the
>>> seconf option in the form.
>>>=20
>>>=20
>>> 2. If I remove the action value above then I can not submit the form as
>>> intended.
>>>=20
>>> 3. If I remove the "onChange=3D"autoSubmit();"" from select tag then I a=
m
>>> not
>>> able to pass the selected value in first option to mysql to get the
>>> result.
>>>=20
>>> I think I reached a place from where it is not possible for me to procee=
d
>>> ahead. I may need to change something which I am not aware of.
>>>=20
>>> Help needed.
>>> Thanks
>>>=20
>>> [php]
>>>
>>> include'login.php';
>>> $conn =3D mysql_connect($db_hostname, $db_username, $db_password );
>>> $db =3D mysql_select_db('rugit',$conn);
>>> if (!$db) die("Unable to connect to MySQL: " . mysql_error());
>>> ?>
>>>=20
>>>
>>> $organism =3D $genomeVer =3D null; //declare vars
>>> if(isset($_GET["organism"]) && is_string($_GET["organism"]))
>>> {
>>> $organism =3D $_GET["organism"];
>>> }
>>> if(isset($_GET["genomeVer"]) && is_string($_GET["genomeVer"]))
>>> {
>>> $genomeVer =3D $_GET["genomeVer"];
>>> }
>>> ?>
>>>=20
>>>
>>>=20
>>>
>>>
>>>=20
>>> [/php]
>>>=20
>>>=20
>>> --=20
>>> Fahim
>>>=20
>>=20
>>=20
>>=20
>> --=20
>> PHP Database Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>=20
>=20
> Karl DeSaulniers
> Design Drumm
> http://designdrumm.com
>=20
>=20
> --=20
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>=20
Or cache the whole thing out to JS arrays and just load those. Do a search o=
n linked dropdowns for sample code. Dynamicdrive.com is where i remember see=
ing some code and I would think that jQuery has something similar
Bastien=
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Hopefully some other PHP programers can find use of it too.
If you have any more jQuery questions though, go to their forum, they
have plenty.
jquery.com
Or email me directly and I'll try to help what I can. :)
Best,
Karl
On May 25, 2011, at 5:04 AM, Fahim Mohammad wrote:
> Thanks Karl
> I am trying my hands on that.
> Thanks again
> fahim
>
> On Tue, May 24, 2011 at 11:55 PM, Karl DeSaulniers
> wrote:
> You could try using Ajax to get the field values from your database.
> And you wouldn't have to refresh the page.
> jQuery ajax does a nice job of this.
>
> HTH,
>
> Karl
>
>
> On May 24, 2011, at 10:27 PM, Jim Giner wrote:
>
> not an expert but from some things that I've done...
> When you handle the selection use JS and set a hidden field on your
> form
> wiht the choice. Do the same with your second dropdown and then
> let them
> click on a 'submit'
> "Fahim Mohammad" wrote in message
> news:BANLkTim47cjrUsXYz=t-Yfhaoz_iUntesA@mail.gmail.com...
> Hi Php users,
> I have a form that has two (has more but for sake of brevity I am
> assuming
> it to be two) dropdown menu.
>
> menu 1: select organism.
>
> menu 2: select genome. This menu depends on the selected value in the
> first
> menu. It query into database and populate the result in this menu.
>
> Once both are selected, I want a submit button that takes me to
> another
> page
> where I can process these values to perform some specific task on the
> database.
>
> I am using the following form tag
>
>
> action =
> 'processForm.php' >
>
> I have the following problem now:
>
> 1. If I keep the action value in the form tag above, after
> selecting the
> first option it direct me to the second page and I am not able to
> select
> the
> seconf option in the form.
>
>
> 2. If I remove the action value above then I can not submit the
> form as
> intended.
>
> 3. If I remove the "onChange="autoSubmit();"" from select tag then
> I am
> not
> able to pass the selected value in first option to mysql to get the
> result.
>
> I think I reached a place from where it is not possible for me to
> proceed
> ahead. I may need to change something which I am not aware of.
>
> Help needed.
> Thanks
>
> [php]
>
> include'login.php';
> $conn = mysql_connect($db_hostname, $db_username, $db_password );
> $db = mysql_select_db('rugit',$conn);
> if (!$db) die("Unable to connect to MySQL: " . mysql_error());
> ?>
>
>
> $organism = $genomeVer = null; //declare vars
> if(isset($_GET["organism"]) && is_string($_GET["organism"]))
> {
> $organism = $_GET["organism"];
> }
> if(isset($_GET["genomeVer"]) && is_string($_GET["genomeVer"]))
> {
> $genomeVer = $_GET["genomeVer"];
> }
> ?>
>
>
>
>
>
>
> [/php]
>
>
> --
> Fahim
>
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> Karl DeSaulniers
> Design Drumm
> http://designdrumm.com
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
> --
> Fahim Mohammad
> Bioinforformatics Lab
> University of Louisville
> Louisville, KY, USA
> Ph: +1-502-409-1167
Karl DeSaulniers
Design Drumm
http://designdrumm.com