Php help me

Résolu
liliana23info Messages postés 11 Date d'inscription   Statut Membre -  
liliana23ino Messages postés 1 Statut Membre -
Bonjour,
jveit garder les selection des bouttons radio de mon formulaire apres avoir un message d'erreur aider moi
Configuration: Windows XP Internet Explorer 7.0

8 réponses

  1. Dr Zoidberg Messages postés 547 Statut Membre 100
     
    Salut,

    Ca ne sert à rien de poster 3 fois le même problèmes !

    Essai peut-être de mieux expliquer ton problème ...

    Comment ton message d'erreur est généré ? par PHP ?
    0
    1. liliana23info Messages postés 11 Date d'inscription   Statut Membre
       
      mon message d'erreur est commsa
      echo '<body onLoad="alert(\'you must answer  for all question first!\')">';
      0
  2. Dr Zoidberg Messages postés 547 Statut Membre 100
     
    Tu as du passer la valeur de tes bouton de ta première page vers le seconde qui test la validité et envoi éventuellement ce message (la page peut être la même).
    Il te suffit de récrire le formulaire après l'écriture du message d'erreur en plaçant un CHECKED sur le bouton correspondant à la valeur transmise.

    Désolé si je ne suis plus très clair à cette heure ci
    0
  3. liliana23info Messages postés 11 Date d'inscription   Statut Membre
     
    le problem c'est que je trouve pas la syntaxe correct j'ai fait sa
    <input type="radio" name="q1" <?php if($q1==0) echo 'checked="checked"'; ?> value="0" >  <label for="q1">go</label>
      <input type="radio" name="q1" <?php if($q1==1) echo 'checked="checked"'; ?> value="1"   ><label for="q1">going</label>
      <input type="radio" name="q1" <?php if($q1==2) echo 'checked="checked"'; ?> value="2"  ><label for="q1">was</label>
      <input type="radio" name="q1"  <?php if($q1==3) echo 'checked="checked"'; ?>  value="3" ><label for="q1">went</label>
      <input type="radio" name="q1"  <?php if($q1==4) echo 'checked="checked"'; ?>  value="4" ><label for="q1">will go</label></li>  

    ca c'est 5 repenses je doit choisir une si je valide sans rien choisir je recoi le message que je t'ai envoyé,un box,apres la selection que j'ai faire s'efface il n'est pas sauvgarder
    0
  4. liliana23info Messages postés 11 Date d'inscription   Statut Membre
     
    tu ma rependu?
    0
  5. Vous n’avez pas trouvé la réponse que vous recherchez ?

    Posez votre question
  6. Dr Zoidberg Messages postés 547 Statut Membre 100
     
    Ca a l'air pas mal,

    tu as bien fait un truc comme
    if(isset($_GET['q1']))$q1=$_GET['q1'];
    ou
    if(isset($_POST['q1']))$q1=$_POST['q1'];

    suivant la méthode utilisée par ton formulaire ?
    0
    1. liliana23info
       
      salut j'ai fait commca
      if(isset($_POST['q1']))$q1=$_POST['q1'];
      il m'affich message d'erreur :Notice: Undefined index: q1 in C:\Program Files\EasyPHP 3.0\www\aaaaa\testniveau1.php on line 33

      checked="checked" value="0" > go
      0
  7. liliana23info
     
    aidez moi svp je suis perdu avec php
    0
  8. Dr Zoidberg Messages postés 547 Statut Membre 100
     
    Peux tu nous poster la ligne 33 et quelques lignes avant afin de mieux localiser le problème.
    0
    1. liliana23info
       
      saut
      voici un morceau du code:
      <form action='traitniveau.php' method="post">
      <i>
      <h3><font face="arial" size="3" color="#2A0055"><i><b>welcom <?php session_start();echo $_SESSION['user'] ?> in this test<p>
      
      Click on one answer for each question in this test
      <p>
      When you are finished, click on the "grade me!" button at the bottom of the page.
      </b></i></font></h3></i>
      
      <hr color="f55fd9" size="2">
                  <i><font color="#2A0055" size="5">Choose the correct answer :</font></i>hey alic 
       <ol type="1">
          <li>Did you ……… anywhere interesting last weekend?
      
       <input type="radio" name="q1"  <?php if(isset($_POST['q1']))$q1=$_POST['q1']) echo 'checked="checked"'; ?> value="0"  >  <label for="q1">go</label>//ligne 33
         <input type="radio"  name="q1"  <?php if(isset($_POST['q1']))$q1=$_POST['q1']) echo 'checked="checked"'; ?> value="1" ><label for="q1">going</label>
         <input type="radio"  name="q1" <?php if(isset($_POST['q1']))$q1=$_POST['q1']) echo 'checked="checked"'; ?>  value="2"  ><label for="q1">was</label>
         <input type="radio"  name="q1" <?php if(isset($_POST['q1']))$q1=$_POST['q1']) echo 'checked="checked"'; ?> value="3"  ><label for="q1">went</label>
         <input type="radio" name="q1" <?php if(isset($_POST['q1']))$q1=$_POST['q1']) echo 'checked="checked"'; ?> value="4"  ><label for="q1">will go</label></li>    
      <hr color="f55fd9" size ="2">
          <li>I think ……… taxi driver
               
               <input type="radio" value="1" name="q2"   ><label for="q2">she's a</label>
               <input type="radio" value="2" name="q2" ><label for="q2">her job is an</label>
               <input type="radio" value="3" name="q2" ><label for="q2"> she's</label>
               <input type="radio" value="4" name="q2" ><label for="q2">work in</label></li>
      <hr color="f55fd9" size ="2">

      ce sont deux question en(echo)
      et les choix des repenses en boutouns radio
      0
  9. Dr Zoidberg Messages postés 547 Statut Membre 100
     
    remplace ta partie
     <input type="radio" name="q1"  <?php if(isset($_POST['q1']))$q1=$_POST['q1']) echo 'checked="checked"'; ?> value="0"  >  <label for="q1">go</label>//ligne 33
       <input type="radio"  name="q1"  <?php if(isset($_POST['q1']))$q1=$_POST['q1']) echo 'checked="checked"'; ?> value="1" ><label for="q1">going</label>
       <input type="radio"  name="q1" <?php if(isset($_POST['q1']))$q1=$_POST['q1']) echo 'checked="checked"'; ?>  value="2"  ><label for="q1">was</label>
       <input type="radio"  name="q1" <?php if(isset($_POST['q1']))$q1=$_POST['q1']) echo 'checked="checked"'; ?> value="3"  ><label for="q1">went</label>
       <input type="radio" name="q1" <?php if(isset($_POST['q1']))$q1=$_POST['q1']) echo 'checked="checked"'; ?> value="4"  ><label for="q1">will go</label></li> 
    

    par exemple par
    <?php 
    if(isset($_POST['q1']))$q1=$_POST['q1']) ;
    else $q1 = -1;
    $check = 'checked="checked"';
    ?>
    
    <input type="radio" name="q1"  <?php if($q1==0) echo $check; ?> value="0"  >  <label for="q1">go</label>//ligne 33
       <input type="radio"  name="q1"  <?php if($q1==1) echo $check; ?> value="1" ><label for="q1">going</label>
       <input type="radio"  name="q1" <?php if($q1==2) echo $check; ?>  value="2"  ><label for="q1">was</label>
       <input type="radio"  name="q1" <?php if($q1==3) echo $check; ?> value="3"  ><label for="q1">went</label>
       <input type="radio" name="q1" <?php if($q1==4) echo '$check; ?> value="4"  ><label for="q1">will go</label></li> 
    
    0
    1. liliana23info
       
      MERCI JE VAIS ESSEYER
      0
    2. liliana23ino Messages postés 1 Statut Membre
       
      salut tu c'est s marcher que pour la premiére question
      e les quesions qui suivent ne se sauvarde pas?
      <form action='traitniveau.php' method="post">
      <i>
      <h3><font face="arial" size="3" color="#2A0055"><i><b>welcom <?php session_start();echo $_SESSION['user'] ?> in this test<p>
      
      Click on one answer for each question in this test
      <p>
      When you are finished, click on the "grade me!" button at the bottom of the page.
      </b></i></font></h3></i>
      
      <hr color="f55fd9" size="2">
                  <i><font color="#2A0055" size="5">Choose the correct answer :</font></i>hey alic 
       <ol type="1">
          <li>Did you ……… anywhere interesting last weekend?
      <?php 
      if(isset($_POST['q1'])) $q1=$_POST['q1'] ;
      else $q1 = -1;
      $check = 'checked="checked"';
      ?>
      
         <input type="radio" name="q1"  <?php if($q1==0) echo $check; ?> value="0"  >  <label for="q1">go</label>
         <input type="radio"  name="q1"  <?php if($q1==1) echo $check; ?> value="1" ><label for="q1">going</label>
         <input type="radio"  name="q1" <?php if($q1==2) echo $check; ?>  value="2"  ><label for="q1">was</label>
         <input type="radio"  name="q1" <?php if($q1==3) echo $check; ?> value="3"  ><label for="q1">went</label>
         <input type="radio" name="q1" <?php if($q1==4) echo $check; ?> value="4"  ><label for="q1">will go</label></li> 
      
      
          
      <hr color="f55fd9" size ="2">
          <li>I think ……… taxi driver
      <?php 
      if(isset($_POST['q2'])) $q2=$_POST['q2'] ;
      else $q2 = -1;
      $check = 'checked="checked"';
      ?>	
               
               <input type="radio"  name="q2" <?php if($q2==0) echo $check; ?> value="0"  ><label for="q2">she's a</label>
               <input type="radio"  name="q2" <?php if($q2==1) echo $check; ?> value="1"><label for="q2">her job is an</label>
               <input type="radio"  name="q2" <?php if($q2==2) echo $check; ?> value="2" ><label for="q2"> she's</label>
               <input type="radio"  name="q2" <?php if($q2==3) echo $check; ?> value="3"><label for="q2">work in</label></li>
      <hr color="f55fd9" size ="2">
          <li>I’m afraid I ……… here for your birthday party.
      <?php 
      if(isset($_POST['q3'])) $q3=$_POST['q3'] ;
      else $q3 = -1;
      $check = 'checked="checked"';
      ?>
               <input type="radio"  name="q3" <?php if($q3==0) echo $check; ?>  value="0" ><label for="q3">have not to be</label>
               <input type="radio"  name="q3" <?php if($q3==1) echo $check; ?> value="1" ><label for="q3">am not being</label>
               <input type="radio"  name="q3" <?php if($q3==2) echo $check; ?> value="2"  ><label for="q3">will be not</label>
               <input type="radio"  name="q3" <?php if($q3==3) echo $check; ?> value="3" ><label for="q3">can't be</label></li>
      0