tqla Posted June 28, 2007 Share Posted June 28, 2007 I'm building a survey in php. I have no code to show. I just want to know if something is possible first. Is it possible to have a question hidden and appear only when a certain question is answered a certain way. For example. If the user answers yes to a question can a follow up question automatically appear. I mean automatically, without clicking a submit button? I think this is what AJAX is all about but I just want to use PHP. Thanks. Quote Link to comment Share on other sites More sharing options...
per1os Posted June 28, 2007 Share Posted June 28, 2007 Ajax with php is possible, but ajax in some form is a must be no matter what language you use. Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted June 28, 2007 Share Posted June 28, 2007 This can be done with JavaScript. You can put the "hidden" question between <div> tags, then toggle the visibility depending on what they answered to the previous question. ajax in some form is a must be no matter what language you use How is that? I don't understand how it is a must, I have never used any AJAX (at least not intentionally) on any websites I have done. I am curious to what your reasoning behind this is. Quote Link to comment Share on other sites More sharing options...
per1os Posted June 28, 2007 Share Posted June 28, 2007 This can be done with JavaScript. You can put the "hidden" question between <div> tags, then toggle the visibility depending on what they answered to the previous question. ajax in some form is a must be no matter what language you use How is that? I don't understand how it is a must, I have never used any AJAX (at least not intentionally) on any websites I have done. I am curious to what your reasoning behind this is. =) The reason I stated it is a must, is if he has questions that need to be displayed based on how they are answered, chances are a "hidden" div wouldn't work because you would need every single question with answer on the page. If he has 1,000 questions, well what would the page size be like? As appose to AJAX he can make a request back and pull the new question so the page load is very small and manageable. I can be done with javascript, but as stated above it depends on how many questions etc whether it is feasible. If he only has 10 questions, than great javascript is the answer. Judging by the nature of the question I think he has more than just a handful of questions. That and doing the hidden div, you are already working with javascript, so why not just extent it a bit and use Ajax ? =) Quote Link to comment Share on other sites More sharing options...
tqla Posted June 28, 2007 Author Share Posted June 28, 2007 Hi pocobueno and frost110. Thank you both for answering my question. pocobueno, that's a great idea! I've already ran some tests and it works well. frost110, I'm sure AJAX is awesome too but I don't even know how to get started. I wish I did. Hopefully someday. Thanks again to you both! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.