I can do this using javascript, no idea in php:

    <p>Do you like this website?
    <input type="radio" name="likeit" value="Yes" checked="checked" /> Yes
    <input type="radio" name="likeit" value="No" /> No
    <input type="radio" name="likeit" value="Not sure" /> Not sure</p>

<p>Your comments:<br />
<textarea name="comments" rows="10" disabled=true cols="40"></textarea></p>

Text area is disactivated, but if the user clicks on "yes" it should activate the text field where disabled turns into false. How would you do this in php?

Thanks

    as php is server side you cant, with out reloading the page, this would be something you commonly do with with js.

      dagon;10943244 wrote:

      as php is server side you cant, with out reloading the page, this would be something you commonly do with with js.

      The problem I am having is if js is turned off. So say you got 3 questions:

        <p>Do you like this website?
          <input type="radio" name="likeit" value="Yes" checked="checked" /> Yes
          <input type="radio" name="likeit" value="No" /> No
          <input type="radio" name="likeit" value="Not sure" /> Not sure</p>
      
      if no go to question 6 otherwise go to question 7
      
      question 6
        <p>why do you like it?
          <input type="radio" name="likeit1" value="oh" checked="checked" /> oh
          <input type="radio" name="likeit1" value="yea" /> yeajh
          <input type="radio" name="likeit1" value="Not sure" /> Not sure</p>
      
      question 7
        <p>should it be changed?
          <input type="radio" name="likeit2" value="oh" checked="checked" /> oh
          <input type="radio" name="likeit2" value="yea" /> yeajh
          <input type="radio" name="likeit2" value="Not sure" /> Not sure</p>
      
      
      

      In jscript I can get them enable/disable accordingly. i.e. in this case if for the first question he presses "yes" it enables all the radio buttons in q 6, if no disables all the radio buttons in q 6. Problem is, if JS is turned off, the flow of the questionnaire is disrupted, meaning the form cannot be filled in. Problomatic as some of my users may not have it turned on.

        Not sure what you're asking then... you want dynamic content, but don't want to use dynamic scripting. You can't have it both ways.

        The only thing PHP can do to enable/disable certain fields based on the user's selection is if you submit the form back to PHP after each question is answered (e.g. display the questions one at a time).

          you could always build it in flash :-) you can chose to only show the form to users that have js, and another to those who don't, or inform those who don't that they need it to proceed.

            Write a Reply...