Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Enhancing a Simple PHP Application Integrating Validation Errors Introducing the Project

PHP and Javascript

I want to work through the two PHP modules (simple project and the enhanced project). I would love to know which lesson has examples of using JavaScript. Specifically, I want to read the option picked by a user in a Select element and turn some checkboxes on accordingly.

Thanks.

8 Answers

George Offley
PLUS
George Offley
Courses Plus Student 7,386 Points

Which lesson I can't tell you, are you looking to get certain information from the lessons?

I am making some changes to an existing PHP project while working through the Treehouse PHP track.

Here is a summary of the changes:

A form has a Select element and a series of checkboxes. Based on what the user selects in the Select element, several checkboxes should be checked.

I would like to do this preferably using Javascript.

  1. PHP generates the form and sends to the browser.

  2. User fills the form. His choice of Select fills in checkboxes. (JavaScript code runs at this time.) He then submits the form.

If there is an example in the PHP track lessons, I would like to view that. I am viewing the lesson in order but I have an immediate need.

Thanks, again.

George Offley
PLUS
George Offley
Courses Plus Student 7,386 Points

Well you could use some java script to detect when you chose something from the drop down then you can use JS to alter the DOM elements to be checked. Does that make sense?

Yes.

If the course has examples, I would like to see them. Thanks.

Thanks. I will look through this. I need to figure out what jsfiddle is first :-)

George Offley
PLUS
George Offley
Courses Plus Student 7,386 Points

It's a website that hosts live code, hit the link and look at the page. It's split up into HTML, CSS, and JS. I use it to test JS scripts.

Thanks.