Change the text of a div

Dadane02 Posted messages 341 Status Member -  
MrHip7 Posted messages 31 Registration date   Status Member Last intervention   -
Hello,

I am looking to change the text of a div in PHP.



Indeed, depending on the response that will be validated, I display a message in the box (which is a div) on the right.

Thank you for your guidance.

Configuration: Windows / Chrome 42.0.2311.90

--
The daily grind will soon derail, who wants to stay inside....
Just hold on tight.

2 answers

  1. MrHip7 Posted messages 31 Registration date   Status Member Last intervention  
     
    Marie is obviously the subject!!! :D

    No seriously, you need to retrieve the data validated by your form when clicking the button using a $_POST method, then, in the right div, you put a condition if($_POST(machin)) displaying this or that thing.
    0
    1. Dadane02 Posted messages 341 Status Member 103
       
      Yes, but I'm having trouble figuring out how to display... I don't know how to tell him. Does it look like: divName.textContent as in JavaScript, that is my question.
      0
    2. MrHip7 Posted messages 31 Registration date   Status Member Last intervention  
       
      Je ne peux pas fournir cette information.
      0
  2. Dadane02 Posted messages 341 Status Member 103
     

    <body>

    <div id="Question" align="center">
    <p><h3>Find the correct function of the word in red in the sentence below.</h3></p>
    <p><u>Sentence 15</u> : <span class="rouge">Marie</span>, do you want to come to the house?</p>
    <form name="form1" method="post" action="#">
    <p>
    <div id="choixDreponses">
    <p>Check the right answer:</p>
    <input type="radio" name="reponse" value="sujett" id="sujet" /> <label for="SUJ">Subject</label><br />
    <input type="radio" name="reponse" value="attr" id="attribut" /> <label for="ATT">Subject attribute</label><br />
    <input type="radio" name="reponse" value="cood" id="cod" /> <label for="COD">C.O.D</label><br />
    <input type="radio" name="reponse" value="apoo" id="apo" /> <label for="APO">Apostrophe</label><br />
    <input type="radio" name="reponse" value="cddn" id="cdn" /> <label for="CDN">C.D.N</label><br />
    <input type="radio" name="reponse" value="cooi" id="coi" /> <label for="COI">C.O.I</label><br/>
    <input type="radio" name="reponse" value="ccc" id="cc" /> <label for="CC">C.C</label><br/>
    <input type="button" onclick="kellereponse()" value="Validate" id="BtnValide">
    </div>
    </p>
    <p>

    </p>
    </form>
    </div>

    </body>
    0
    1. Dadane02 Posted messages 341 Status Member 103
       
      PS: The window is too small for it to be displayed properly :/
      0
    2. MrHip7 Posted messages 31 Registration date   Status Member Last intervention  
       
      Il faut que tu renomme tes input déjà. Ils s'appellent tous réponse, change les en reponse1, reponse2 etc...
      ensuite, à la validation, tu récupères la variable reponse1
      if(isset($_POST['reponse1'])){ ?> <div> Bravo! </div>//ta div <?php } else{ ?> <div> Faux </div>//ta div <?php } ?> 
      0