Jump to content

dropdown event


MannyG

Recommended Posts

No I know that in the dropdown I can use an onselect command, but in a if statement where the condition is applied is what I am talking about...so if(onSelect == true) sort of thing, dont know how to do that, here is pseudocode:

 

      //drop down that communicates with mysql

          if(anything_in_dropdown_has_been_selected == true)

            {

              //execute this

          }

 

          else

          {

          //execute this

          }

Link to comment
https://forums.phpfreaks.com/topic/199004-dropdown-event/#findComment-1044571
Share on other sites

No I know that in the dropdown I can use an onselect command, but in a if statement where the condition is applied is what I am talking about...so if(onSelect == true) sort of thing, dont know how to do that, here is pseudocode:

 

      //drop down that communicates with mysql

          if(anything_in_dropdown_has_been_selected == true)

            {

              //execute this

          }

 

          else

          {

          //execute this

          }

 

You should never need to check an event outside of the control the event is for... that's why they are used there. I'm confused at why you are trying to check an onselect outside... And why would you have an else? So if the user is not constantly selecting something then it would do some other code? I'm sure there is a much better way to do what you are wanting to do. Please explain the entire problem you are trying to find a solution for. What are you trying to do?

Link to comment
https://forums.phpfreaks.com/topic/199004-dropdown-event/#findComment-1044580
Share on other sites

No I know that in the dropdown I can use an onselect command, but in a if statement where the condition is applied is what I am talking about...so if(onSelect == true) sort of thing, dont know how to do that, here is pseudocode:

 

      //drop down that communicates with mysql

          if(anything_in_dropdown_has_been_selected == true)

            {

              //execute this

          }

 

          else

          {

          //execute this

          }

 

You should never need to check an event outside of the control the event is for... that's why they are used there. I'm confused at why you are trying to check an onselect outside... And why would you have an else? So if the user is not constantly selecting something then it would do some other code? I'm sure there is a much better way to do what you are wanting to do. Please explain the entire problem you are trying to find a solution for. What are you trying to do?

 

Well I have a table that displays information about products, and you can use the dropdown as a search filter (which sends a specific query to the db and displays the results in the same table), well if nothing is selecte dthen all the data is displayed which is why i have the if-statement...if there is a required search query, run it, else just display all the info

Link to comment
https://forums.phpfreaks.com/topic/199004-dropdown-event/#findComment-1044583
Share on other sites

No I know that in the dropdown I can use an onselect command, but in a if statement where the condition is applied is what I am talking about...so if(onSelect == true) sort of thing, dont know how to do that, here is pseudocode:

 

      //drop down that communicates with mysql

          if(anything_in_dropdown_has_been_selected == true)

            {

              //execute this

          }

 

          else

          {

          //execute this

          }

 

You should never need to check an event outside of the control the event is for... that's why they are used there. I'm confused at why you are trying to check an onselect outside... And why would you have an else? So if the user is not constantly selecting something then it would do some other code? I'm sure there is a much better way to do what you are wanting to do. Please explain the entire problem you are trying to find a solution for. What are you trying to do?

 

Well I have a table that displays information about products, and you can use the dropdown as a search filter (which sends a specific query to the db and displays the results in the same table), well if nothing is selecte dthen all the data is displayed which is why i have the if-statement...if there is a required search query, run it, else just display all the info

 

So you are using ajax to do this then? All you need to do is create a function that holds the ajax code in it for what you need to do. Then in the onselect event you call that function. I assume you know how to get the current value of the drop down box.

Link to comment
https://forums.phpfreaks.com/topic/199004-dropdown-event/#findComment-1044593
Share on other sites

im using php, html, javascript, css only

 

ajax is not a language but rather a way of using javascript to call php. Are you using the xmlHttpRequest? or ajax/post functions?

oh, um no I am not...no idea what ajax is or how to use it..is there anyway to do this without the use of ajax? for example

 

onselect i send a value to some javascript method making a value = 1 and then in php if-statement i check condition if that var is 1 then execute this, else dont...problem is i dont know how to use a javascript variable in php code o_O

Link to comment
https://forums.phpfreaks.com/topic/199004-dropdown-event/#findComment-1044700
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.