By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,304 Members | 1,242 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,304 IT Pros & Developers. It's quick & easy.

Drop down Event which calls php scripts

P: 1
Hi,

I have a drop down whose values are as follows and will be stored in a sql table:
-one
-two
-three

When a value is selected in drop down then a certain list has to be displayed which needs to be pulled from sql table... list will vary based on selection...
e.g., When one is selected then display following items:
1] one
2] one one
3] one one one

I am new in php so please guide me how to make this happen or please provide a sample code....

Thanks and Regards,
Vaibhav
Aug 30 '08 #1
Share this Question
Share on Google+
1 Reply


P: 49
Hi,

I have a drop down whose values are as follows and will be stored in a sql table:
-one
-two
-three

When a value is selected in drop down then a certain list has to be displayed which needs to be pulled from sql table... list will vary based on selection...
e.g., When one is selected then display following items:
1] one
2] one one
3] one one one

I am new in php so please guide me how to make this happen or please provide a sample code....

Thanks and Regards,
Vaibhav
You can do this through AJAX.

Another way is
if page refreshing wont matter that much then you can simply pass the value to the query.
Expand|Select|Wrap|Line Numbers
  1. <form name="myform" id="myform" action="" method="get">
  2.  
  3. <select name="mydropdown" id="mydropdown" onchange="sortby_form.submit()" >
  4.  
  5. <option value='one'>One</option>
  6. <option value='two'>Two</option>
  7. <option value='three'>Three</option>
  8.  
  9. </select>
  10.  
  11. </form>
  12.  
So when any value is selected from the dropdown menu, form will be submitted and the $mydropdown will be passed. You can use this value in your query.
Aug 30 '08 #2

Post your reply

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