PHP besoin d'aide case Pronto!

  • Bogey
  • Bogey
  • Genius
  • Avatar de l’utilisateur
  • Inscription: Juil 14, 2005
  • Messages: 8211
  • Loc: USA
  • Status: Offline

Message Septembre 23rd, 2010, 12:34 am

righteous_trespasser a écrit:
Je pense que vous vous approchez de ce mauvais angle...Au lieu de soumettre le formulaire et en créant un lien à partir des valeurs de poste, et non seulement inclure les fichiers corrects...Donc, en d'autres termes, de créer des fichiers solution_1.html solution_10.html et pas les inclure, si nécessaire...comme ceci:

form.html

HTML Code: [ Select ]
<form action="checkbox-control.php" method="post">
  Please, check all the boxes that applies to your current sitiation:<br /><br />
  <input type="checkbox" name="problem[]" value="A" />Problem 1.<br />
  <input type="checkbox" name="problem[]" value="B" />Problem 2.<br />
  <input type="checkbox" name="problem[]" value="C" />Problem 3.<br />
  <input type="checkbox" name="problem[]" value="D" />Problem 4.<br />
  <input type="checkbox" name="problem[]" value="E" />Problem 5.<br />
  <input type="checkbox" name="problem[]" value="F" />Problem 6.<br />
  <input type="checkbox" name="problem[]" value="G" />Problem 7.<br />
  <input type="checkbox" name="problem[]" value="H" />Problem 8.<br />
  <input type="checkbox" name="problem[]" value="I" />Problem 9.<br />
  <input type="checkbox" name="problem[]" value="J" />Problem 10.<br />
<center><input type="submit" name="formSubmit" value="Submit" /></center><br /><br />
<br /> If your problem is not listed here then please let me know so.<br />
</form>
  1. <form action="checkbox-control.php" method="post">
  2.   Please, check all the boxes that applies to your current sitiation:<br /><br />
  3.   <input type="checkbox" name="problem[]" value="A" />Problem 1.<br />
  4.   <input type="checkbox" name="problem[]" value="B" />Problem 2.<br />
  5.   <input type="checkbox" name="problem[]" value="C" />Problem 3.<br />
  6.   <input type="checkbox" name="problem[]" value="D" />Problem 4.<br />
  7.   <input type="checkbox" name="problem[]" value="E" />Problem 5.<br />
  8.   <input type="checkbox" name="problem[]" value="F" />Problem 6.<br />
  9.   <input type="checkbox" name="problem[]" value="G" />Problem 7.<br />
  10.   <input type="checkbox" name="problem[]" value="H" />Problem 8.<br />
  11.   <input type="checkbox" name="problem[]" value="I" />Problem 9.<br />
  12.   <input type="checkbox" name="problem[]" value="J" />Problem 10.<br />
  13. <center><input type="submit" name="formSubmit" value="Submit" /></center><br /><br />
  14. <br /> If your problem is not listed here then please let me know so.<br />
  15. </form>


case-control. php

PHP Code: [ Select ]
<?php
  for($i=0;$i<11;$i++){
    if(isset($_POST['problem'][$i]) && !empty($_POST['problem'][$i])){
      include("includes/solution_$i.html");
    }
  }
?>
  1. <?php
  2.   for($i=0;$i<11;$i++){
  3.     if(isset($_POST['problem'][$i]) && !empty($_POST['problem'][$i])){
  4.       include("includes/solution_$i.html");
  5.     }
  6.   }
  7. ?>

Quelqu'un raté mon précédent post :P
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • Anonymous
  • Bot
  • No Avatar
  • Inscription: 25 Feb 2008
  • Messages: ?
  • Loc: Ozzuland
  • Status: Online

Message Septembre 23rd, 2010, 12:34 am

  • BomWatchout
  • Newbie
  • Newbie
  • No Avatar
  • Inscription: Sep 20, 2010
  • Messages: 12
  • Status: Offline

Message Septembre 23rd, 2010, 12:47 am

J'ai ceci:

Code: [ Select ]
<?php
$pro = $_POST['problem'];

if(empty($pro))
{
echo("You got this error because you didnt select any issue.<br />
  Please, click the back bottom and recheck your issues.");
}
else
{
$N = count($pro);

echo("You selected $N issues(s) in your computer: ");


 for($i=0;$i<11;$i++){
  if(isset($_POST['problem'][$i]) && !empty($_POST['problem'][$i])){
   include("includes/solution_$i.html");
  }
 }
?>
  1. <?php
  2. $pro = $_POST['problem'];
  3. if(empty($pro))
  4. {
  5. echo("You got this error because you didnt select any issue.<br />
  6.   Please, click the back bottom and recheck your issues.");
  7. }
  8. else
  9. {
  10. $N = count($pro);
  11. echo("You selected $N issues(s) in your computer: ");
  12.  for($i=0;$i<11;$i++){
  13.   if(isset($_POST['problem'][$i]) && !empty($_POST['problem'][$i])){
  14.    include("includes/solution_$i.html");
  15.   }
  16.  }
  17. ?>

Mise en erreur de syntaxe dans la ligne 21
  • Bogey
  • Bogey
  • Genius
  • Avatar de l’utilisateur
  • Inscription: Juil 14, 2005
  • Messages: 8211
  • Loc: USA
  • Status: Offline

Message Septembre 23rd, 2010, 12:48 am

Le d'autre n'est pas fermé. Vous avez besoin d'un plus ) avant la ?>
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • BomWatchout
  • Newbie
  • Newbie
  • No Avatar
  • Inscription: Sep 20, 2010
  • Messages: 12
  • Status: Offline

Message Septembre 23rd, 2010, 12:54 am

ok le vois maintenant, mais ce n'est pas encore ce que je suis à la recherche. Comme je l'ai dit "ce sont des cases à cocher ne vise pas à donner à l'utilisateur le lien direct tutoriel, ils sont destinés à me faire connaître leur situation actuelle et des que je vais leur accorder un tutoriel.

Ce sera simplement donner ouvrir un tutoriel pour chaque case à cocher ..

extrait:

box1 j'ai windows XP
box2 j'ai un 32-bit OS
box3 je n'ai pas le jeu

Quel genre de tutoriel, il serait si elles seulement case à cocher 1?

Je pense que les noms de fichiers tutoriel devrait être ressemblant tutorial_ABC ou tutorial_BDGEJ etc.
  • BomWatchout
  • Newbie
  • Newbie
  • No Avatar
  • Inscription: Sep 20, 2010
  • Messages: 12
  • Status: Offline

Message Septembre 23rd, 2010, 1:33 am

Enfin, je l'ai fait! :D

Je dois vous remercier un bogey beaucoup pour le temps et la patience pour passé ici, vous avez vraiment m'aider à l'homme, je vous dois une pour cela. Vous aussi, vous righteous_trespasser, Merci pour le soutien.
Vous les gars fait ma journée à l'heure actuelle. Je ne peux pas trouver les mots pour dire combien je suis reconnaissant! gif "alt =": D "title =" très heureux ">

ok voici le résultat final:

Forum.html
Code: [ Select ]
<form action="checkbox-control.php" method="post">
 Please, check all the boxes that applies to your current sitiation:<br /><br />
 <input type="checkbox" name="problem[]" value="A" />Problem 1.<br />
 <input type="checkbox" name="problem[]" value="B" />Problem 2.<br />
 <input type="checkbox" name="problem[]" value="C" />Problem 3.<br />
 <input type="checkbox" name="problem[]" value="D" />Problem 4.<br />
 <input type="checkbox" name="problem[]" value="E" />Problem 5.<br />
 <input type="checkbox" name="problem[]" value="F" />Problem 6.<br />
 <input type="checkbox" name="problem[]" value="G" />Problem 7.<br />
 <input type="checkbox" name="problem[]" value="H" />Problem 8.<br />
 <input type="checkbox" name="problem[]" value="I" />Problem 9.<br />
 <input type="checkbox" name="problem[]" value="J" />Problem 10.<br />
<center><input type="submit" name="formSubmit" value="Submit" /></center><br /><br />
<br /> If your problem is not listed here then please let me know so.<br />
</form>
  1. <form action="checkbox-control.php" method="post">
  2.  Please, check all the boxes that applies to your current sitiation:<br /><br />
  3.  <input type="checkbox" name="problem[]" value="A" />Problem 1.<br />
  4.  <input type="checkbox" name="problem[]" value="B" />Problem 2.<br />
  5.  <input type="checkbox" name="problem[]" value="C" />Problem 3.<br />
  6.  <input type="checkbox" name="problem[]" value="D" />Problem 4.<br />
  7.  <input type="checkbox" name="problem[]" value="E" />Problem 5.<br />
  8.  <input type="checkbox" name="problem[]" value="F" />Problem 6.<br />
  9.  <input type="checkbox" name="problem[]" value="G" />Problem 7.<br />
  10.  <input type="checkbox" name="problem[]" value="H" />Problem 8.<br />
  11.  <input type="checkbox" name="problem[]" value="I" />Problem 9.<br />
  12.  <input type="checkbox" name="problem[]" value="J" />Problem 10.<br />
  13. <center><input type="submit" name="formSubmit" value="Submit" /></center><br /><br />
  14. <br /> If your problem is not listed here then please let me know so.<br />
  15. </form>


Checkbox-control.php

Code: [ Select ]
<html>
<?php
$pro = $_POST['problem'];
if(empty($pro))
{
echo("You got this error because you didnt select any issue.<br />
  Please, click the back bottom and recheck your issues.");
}
else
{
$N = count($pro);

echo("You selected $N issues(s) in your computer: ");
}

?>
<br /><br />
Based on what you choosed, we recommend the following tutorial for you<br /><br />
<center>
<a href=
 "tutorial_<?php
  for($i=0; $i < $N; $i++)
  {
   echo($pro[$i]); 
  }
  ?>.html
">your tutorial</a>
</center>
</html>
  1. <html>
  2. <?php
  3. $pro = $_POST['problem'];
  4. if(empty($pro))
  5. {
  6. echo("You got this error because you didnt select any issue.<br />
  7.   Please, click the back bottom and recheck your issues.");
  8. }
  9. else
  10. {
  11. $N = count($pro);
  12. echo("You selected $N issues(s) in your computer: ");
  13. }
  14. ?>
  15. <br /><br />
  16. Based on what you choosed, we recommend the following tutorial for you<br /><br />
  17. <center>
  18. <a href=
  19.  "tutorial_<?php
  20.   for($i=0; $i < $N; $i++)
  21.   {
  22.    echo($pro[$i]); 
  23.   }
  24.   ?>.html
  25. ">your tutorial</a>
  26. </center>
  27. </html>

J'ai réellement l'espoir à quelqu'un d'autre Cela peut être utile dans l'avenir. Merci encore les gars, ce rocher forum et je ne serai pas le laisser dans un proche avenir :D
  • Bogey
  • Bogey
  • Genius
  • Avatar de l’utilisateur
  • Inscription: Juil 14, 2005
  • Messages: 8211
  • Loc: USA
  • Status: Offline

Message Septembre 23rd, 2010, 10:38 am

Nous devons avoir manquez pas compris ce que vous demandiez tout ce temps :shock: Heureux que vous ayez compris.
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • BomWatchout
  • Newbie
  • Newbie
  • No Avatar
  • Inscription: Sep 20, 2010
  • Messages: 12
  • Status: Offline

Message Septembre 23rd, 2010, 1:48 pm

Eh bien, maintenant j'ai besoin de raccourcir ces résultats par écho-tion des erreurs si l'utilisateur à vérifier certaines cases ensemble. Je sais que cela peut être résolu en utilisant le "si" et "else". Serait-il trop demander?

Je vais montrer un échantillon en utilisant mes connaissances php mauvaise gif "alt = =":)" titre" Smile ">

Code: [ Select ]
<html>

<?php

$pro = $_POST['problem'];

if(empty($pro))
{
echo("You got this error because you didnt select any issue.<br />
  Please, click the back bottom and recheck your issues.");
}
else
{
$N = count($pro);

echo("You selected $N issues(s) in your computer: ");
}

?>
<br /><br />

Based on what you choosed, we recommend the following tutorial for you<br /><br />
<center>
<a href="tutorial_<?php
for($i=0; $i < $N; $i++)
{
  $p = ($pro[$i]);
  $a = array(($pro[$i]));
  if(array_key_exists("A"||"AB"||"ABC",$a)) /*<-- in here I meant to say if the value A (only) or the values AB (only) or values ABC (only) exist in the array...*\
  {
  echo("error");
  }
  else
  {
  echo($p);
  }
}
?>.html
">your tutorial</a>
</html>
  1. <html>
  2. <?php
  3. $pro = $_POST['problem'];
  4. if(empty($pro))
  5. {
  6. echo("You got this error because you didnt select any issue.<br />
  7.   Please, click the back bottom and recheck your issues.");
  8. }
  9. else
  10. {
  11. $N = count($pro);
  12. echo("You selected $N issues(s) in your computer: ");
  13. }
  14. ?>
  15. <br /><br />
  16. Based on what you choosed, we recommend the following tutorial for you<br /><br />
  17. <center>
  18. <a href="tutorial_<?php
  19. for($i=0; $i < $N; $i++)
  20. {
  21.   $p = ($pro[$i]);
  22.   $a = array(($pro[$i]));
  23.   if(array_key_exists("A"||"AB"||"ABC",$a)) /*<-- in here I meant to say if the value A (only) or the values AB (only) or values ABC (only) exist in the array...*\
  24.   {
  25.   echo("error");
  26.   }
  27.   else
  28.   {
  29.   echo($p);
  30.   }
  31. }
  32. ?>.html
  33. ">your tutorial</a>
  34. </html>

Pour de plus amples que je cherche, il semble ne pas appliquer le "if" j'ai ajouté...Il va un peu plus de lui et les États "else" déclaration.
Peu d'aide s'il vous plaît? :D

Afficher de l'information

  • Total des messages de ce sujet: 22 messages
  • Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 127 invités
  • Vous ne pouvez pas poster de nouveaux sujets
  • Vous ne pouvez pas répondre aux sujets
  • Vous ne pouvez pas éditer vos messages
  • Vous ne pouvez pas supprimer vos messages
  • Vous ne pouvez pas joindre des fichiers
 
 

© 2011 Unmelted, LLC. Ozzu® est une marque déposée de Unmelted, LLC