need php checkbox help PRONTO!

  • BomWatchout
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Sep 20, 2010
  • Posts: 12
  • Status: Offline

Post September 20th, 2010, 3:54 pm

I want to create a php checkbox tutorial for my forum soon as possible. I have alot of messages from eveyone in the forum and that just consumes alot of my bandwidth. So, instead of doing something about stopping those messages i want to create that tutorial. The problem I am having with it right now is that i want to start it up with a few questions, using the checkboxes, in the checkboxes i want to have the problems they are getting. Once they click the "submit" buttum i want the tutorial to open one of several pages i have ready to solve them.

To put it more clear. Depending on what they choose from the checkboxes, they will get a different page once they click "submit". for example if they check box1, box2 and box3 then submit, they will be redirected to a different place than then one they will be if they check the box1 and box2.
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post September 20th, 2010, 3:54 pm

  • Bogey
  • Bogey
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 8212
  • Loc: USA
  • Status: Offline

Post September 20th, 2010, 9:45 pm

Form.html
HTML Code: [ Select ]
<form method="post" action="tutorial.php">
Check Name 1 <input type="checkbox" name="Check_Name[]" />
Check Name 2 <input type="checkbox" name="Check_Name[]" />
Check Name 3 <input type="checkbox" name="Check_Name[]" />
<input type="submit" name="Submit" /></form>
  1. <form method="post" action="tutorial.php">
  2. Check Name 1 <input type="checkbox" name="Check_Name[]" />
  3. Check Name 2 <input type="checkbox" name="Check_Name[]" />
  4. Check Name 3 <input type="checkbox" name="Check_Name[]" />
  5. <input type="submit" name="Submit" /></form>

tutorial.php
PHP Code: [ Select ]
<?php
if(isset($_POST['submit']))
{
    $p = null;
    if(isset($_POST[check_name[0]]))
    {
        $p .= '0';
    }
    if(isset($_POST[check_name[1]))
    {
        $p .= '1';
    }
    if(isset($_POST[check_name[2]))
    {
        $p .= '2';
    }
    if(!isset($_POST[check_name[0]) && !isset($_POST[check_name[1]) && !isset($_POST[check_name[2]))
    {
        $p = '012';
    }
 
    $page = "tutorial_$p";
 
    // Now you redirect the user to $page
}
?>
  1. <?php
  2. if(isset($_POST['submit']))
  3. {
  4.     $p = null;
  5.     if(isset($_POST[check_name[0]]))
  6.     {
  7.         $p .= '0';
  8.     }
  9.     if(isset($_POST[check_name[1]))
  10.     {
  11.         $p .= '1';
  12.     }
  13.     if(isset($_POST[check_name[2]))
  14.     {
  15.         $p .= '2';
  16.     }
  17.     if(!isset($_POST[check_name[0]) && !isset($_POST[check_name[1]) && !isset($_POST[check_name[2]))
  18.     {
  19.         $p = '012';
  20.     }
  21.  
  22.     $page = "tutorial_$p";
  23.  
  24.     // Now you redirect the user to $page
  25. }
  26. ?>

This approach will do the following.

You have 3 checkboxes. For each possibility you will have a page.

There are 6 different pages that to be made:

tutorial_0
tutorial_1
tutorial_2
tutorial_01
tutorial_02
tutorial_12

This is in no way the best solution because I'm not thinking well right now.
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • BomWatchout
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Sep 20, 2010
  • Posts: 12
  • Status: Offline

Post September 21st, 2010, 7:44 am

thanks alot for the coding. One last thing i want to ask? I am not that good at php, how can i redirect a user to a string value without them having to click any links?

I mean, from that .php file, just open then $page string once the value for it had been defined.

Code: [ Select ]
 ..if(!isset($_POST[check_name[0]) && !isset($_POST[check_name[1]) && !isset($_POST[check_name[2]))
  {
    $p = '012';
  }

  $page = "tutorial_$p"; <-- [here]

  // Now you redirect the user to $page
...
  1.  ..if(!isset($_POST[check_name[0]) && !isset($_POST[check_name[1]) && !isset($_POST[check_name[2]))
  2.   {
  3.     $p = '012';
  4.   }
  5.   $page = "tutorial_$p"; <-- [here]
  6.   // Now you redirect the user to $page
  7. ...


I also get a parse error in line 5, not sure exactly what it is...
  • Bogey
  • Bogey
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 8212
  • Loc: USA
  • Status: Offline

Post September 21st, 2010, 12:03 pm

This code has to be before the header or anything.

PHP Code: [ Select ]
<?php
header("LOCATION: $page");
?>
  1. <?php
  2. header("LOCATION: $page");
  3. ?>


I'm pretty sure it is
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • BomWatchout
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Sep 20, 2010
  • Posts: 12
  • Status: Offline

Post September 21st, 2010, 2:02 pm

I am still getting parse error with the tutorial.php code you provided, can't find the exact place of the error, just know is in line 5..

Code: [ Select ]
<?php
if(isset($_POST['submit']))
{
  $p = null;
  if(isset($_POST[check_name[0]]))
  {
    $p .= '0';
  }
  if(isset($_POST[check_name[1]))
  {
    $p .= '1';
  }
  if(isset($_POST[check_name[2]))
  {
    $p .= '2';
  }
  if(!isset($_POST[check_name[0]) && !isset($_POST[check_name[1]) && !isset($_POST[check_name[2]))
  {
    $p = '012';
  }

  $page = "tutorial_$p";

  // Now you redirect the user to $page
}
?>
  1. <?php
  2. if(isset($_POST['submit']))
  3. {
  4.   $p = null;
  5.   if(isset($_POST[check_name[0]]))
  6.   {
  7.     $p .= '0';
  8.   }
  9.   if(isset($_POST[check_name[1]))
  10.   {
  11.     $p .= '1';
  12.   }
  13.   if(isset($_POST[check_name[2]))
  14.   {
  15.     $p .= '2';
  16.   }
  17.   if(!isset($_POST[check_name[0]) && !isset($_POST[check_name[1]) && !isset($_POST[check_name[2]))
  18.   {
  19.     $p = '012';
  20.   }
  21.   $page = "tutorial_$p";
  22.   // Now you redirect the user to $page
  23. }
  24. ?>
  • righteous_trespasser
  • Scuffle
  • Genius
  • User avatar
  • Joined: Mar 12, 2007
  • Posts: 6228
  • Loc: South-Africa
  • Status: Offline

Post September 21st, 2010, 11:43 pm

you need to replace the following:

PHP Code: [ Select ]
isset($_POST[checkname[0]])


with the following:

PHP Code: [ Select ]
isset($_POST['check_name'][0])
Let's leave all our *plum* where it is and go live in the jungle ...
  • Bogey
  • Bogey
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 8212
  • Loc: USA
  • Status: Offline

Post September 22nd, 2010, 1:42 pm

I haven't coded for a while if you haven't noticed :D


Welcome back R_T
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • BomWatchout
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Sep 20, 2010
  • Posts: 12
  • Status: Offline

Post September 22nd, 2010, 8:12 pm

sorry for my delay answering... my forum went down so I guess there wont be any hurries to get the codes now :(

ok so, so far what i have is this

Form.html

Code: [ Select ]
<form method="post" action="tutorial.php">
Check Name 1 <input type="checkbox" name="Check_Name[]" />
Check Name 2 <input type="checkbox" name="Check_Name[]" />
Check Name 3 <input type="checkbox" name="Check_Name[]" />
<input type="submit" name="Submit" /></form>
  1. <form method="post" action="tutorial.php">
  2. Check Name 1 <input type="checkbox" name="Check_Name[]" />
  3. Check Name 2 <input type="checkbox" name="Check_Name[]" />
  4. Check Name 3 <input type="checkbox" name="Check_Name[]" />
  5. <input type="submit" name="Submit" /></form>


tutorial.php

Code: [ Select ]
<?php
 header("LOCATION: $page");
if(isset($_POST['submit']))
{
  $p = null;
  if(isset($_POST['check_name'][0]]))
  {
    $p .= '0';
  }
  if(isset($_POST['check_name'][1]))
  {
    $p .= '1';
  }
  if(isset($_POST['check_name'][2]))
  {
    $p .= '2';
  }
  if(!isset($_POST['check_name'][0]) && !isset($_POST['check_name'][1]) && !isset($_POST['check_name'][2]))
  {
    $p = '012';
  }

  $page = "tutorial_$p";


}
?>
  1. <?php
  2.  header("LOCATION: $page");
  3. if(isset($_POST['submit']))
  4. {
  5.   $p = null;
  6.   if(isset($_POST['check_name'][0]]))
  7.   {
  8.     $p .= '0';
  9.   }
  10.   if(isset($_POST['check_name'][1]))
  11.   {
  12.     $p .= '1';
  13.   }
  14.   if(isset($_POST['check_name'][2]))
  15.   {
  16.     $p .= '2';
  17.   }
  18.   if(!isset($_POST['check_name'][0]) && !isset($_POST['check_name'][1]) && !isset($_POST['check_name'][2]))
  19.   {
  20.     $p = '012';
  21.   }
  22.   $page = "tutorial_$p";
  23. }
  24. ?>


Now i get this error for tutorial.php:
Parse error: parse error, expecting `','' or `')'' on line 6 :(





Yesterday, I was making some research on this and found something close to what I'm looking for. I think that the only thing I have to fix is the outcome after people hit submit:

Tutorial.php

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 ]
<?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 < $N; $i++)
 {
  echo($pro[$i] . " ");
 }


}

?> <br /><br />

Based on what you choosed, we recommend the following tutorial for you<br />
<a href="link to tutorial here">sample</a>
  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 < $N; $i++)
  13.  {
  14.   echo($pro[$i] . " ");
  15.  }
  16. }
  17. ?> <br /><br />
  18. Based on what you choosed, we recommend the following tutorial for you<br />
  19. <a href="link to tutorial here">sample</a>


This will just echo back what you selected. I want the checkbox-control.php to automatically generate a link to one of my tutorials depending on what the people checked in tutorial.php just like Bogey was doing
  • Bogey
  • Bogey
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 8212
  • Loc: USA
  • Status: Offline

Post September 22nd, 2010, 10:01 pm

PHP Code: [ Select ]
if(isset($_POST['check_name'][0]]))

The last ' ] ' is extra


I'm sorry, the header("LOCAT..... thing needs to be right after you define $page.


I meant that it needs to go before any HTML. It can go after PHP but not before any HTML.
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • BomWatchout
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Sep 20, 2010
  • Posts: 12
  • Status: Offline

Post September 22nd, 2010, 11:45 pm

I am feeling kinda embarrassed to ask you this but can you please tell me how i can fix the one I am currently working on? yours is good but I already started working on this one:



Tutorial.php

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 ]
<?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 < $N; $i++)
 {
  echo($pro[$i] . " ");
 }


}

?> <br /><br />

Based on what you choosed, we recommend the following tutorial for you<br />
<a href="link to tutorial here">sample</a>
  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 < $N; $i++)
  13.  {
  14.   echo($pro[$i] . " ");
  15.  }
  16. }
  17. ?> <br /><br />
  18. Based on what you choosed, we recommend the following tutorial for you<br />
  19. <a href="link to tutorial here">sample</a>


..and yes, I have about 10 reported problems. Thank you for your time
  • Bogey
  • Bogey
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 8212
  • Loc: USA
  • Status: Offline

Post September 22nd, 2010, 11:48 pm

Well, if it's ten problems you don't want to make like 100 different pages :lol:



Alright. I got another possible solution for you. It requires a bit more PHP though.

This one's a bit different then the other one.

For each problem you have a tutorial on how to fix something. Problem 1 would be check box #1, problem 2 would be check box #2 and so on...

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

Remember that in this way, you are including the contents of one page inside of another page, so in the problem_1.html through problem_10.html all you put in there is the tutorial... the body. No <html><head><body> tags or anything like that.

I'm also not sure if this is suitable to your needs.

(I'm also not 100% sure about the PHP... it should work, but if it brings up errors... well, post it here if you can't fix them).
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • BomWatchout
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Sep 20, 2010
  • Posts: 12
  • Status: Offline

Post September 22nd, 2010, 11:57 pm

well, is not really that many tutorials i have to make because I also plan on finding a way to send an error if certain boxes combinations are checked. You see, the list of 10 I have is not really all the reported problems.


I will tell you the complete story, that way we will be in the same page.

I host a forum of YuGiOh. The game you can download for free and play online also for free. There are drawbacks with the game though, bad things. One of them is that the game won't save until some registry problems are solved. There are also ways to get all the game cards using some tutorials i made, but there are problems with that too, problems like: if you do it wrong you might end up getting black screen or game not opening at all.

Back in my forum I have alot of resources for the game, like modifications and stuff and that is one of the reasons why people keep coming, that and to look for answers to those problems i mentioned. The list I want to make will just INFORM me of their current situation, based on that, I will grant them with a tutorial that fits their situation. Here is the complete list I want to post:

Code: [ Select ]
<form action="checkbox-form.php" method="post">
  Please, check all the boxes that applies to your current sitiation:<br /><br />
  <input type="checkbox" name="problem[]" value="A" />I am using a 32-bit computer.<br />
  <input type="checkbox" name="problem[]" value="B" />I am using Windows 7 / vista.<br />
  <input type="checkbox" name="problem[]" value="C" />I am using Windows XP.<br />
  <input type="checkbox" name="problem[]" value="D" />I used BomWatchOut's installer but i still do not have all cards.<br />
  <input type="checkbox" name="problem[]" value="E" />I have the game.<br />
  <input type="checkbox" name="problem[]" value="F" />I do not have the game.<br />
  <input type="checkbox" name="problem[]" value="G" />*I am not sure if i have only one Yu-Gi-Oh! game in my computer.*<br />
  <input type="checkbox" name="problem[]" value="H" />I cannot save replays and/or decks.<br />
  <input type="checkbox" name="problem[]" value="I" />I get a black screen and I cannot see anything.<br />
  <input type="checkbox" name="problem[]" value="J" />I don't know where my "run" command is.<br />
<center><input type="submit" name="formSubmit" value="Submit" /></center><br /><br />
Please, pay special attention to the boxes with a *<br /> If your problem is not listed here then please let me know so.<br />
<b>If you check more boxes than the ones you have to, then you might end up getting nothing</b>
</form>
  1. <form action="checkbox-form.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" />I am using a 32-bit computer.<br />
  4.   <input type="checkbox" name="problem[]" value="B" />I am using Windows 7 / vista.<br />
  5.   <input type="checkbox" name="problem[]" value="C" />I am using Windows XP.<br />
  6.   <input type="checkbox" name="problem[]" value="D" />I used BomWatchOut's installer but i still do not have all cards.<br />
  7.   <input type="checkbox" name="problem[]" value="E" />I have the game.<br />
  8.   <input type="checkbox" name="problem[]" value="F" />I do not have the game.<br />
  9.   <input type="checkbox" name="problem[]" value="G" />*I am not sure if i have only one Yu-Gi-Oh! game in my computer.*<br />
  10.   <input type="checkbox" name="problem[]" value="H" />I cannot save replays and/or decks.<br />
  11.   <input type="checkbox" name="problem[]" value="I" />I get a black screen and I cannot see anything.<br />
  12.   <input type="checkbox" name="problem[]" value="J" />I don't know where my "run" command is.<br />
  13. <center><input type="submit" name="formSubmit" value="Submit" /></center><br /><br />
  14. Please, pay special attention to the boxes with a *<br /> If your problem is not listed here then please let me know so.<br />
  15. <b>If you check more boxes than the ones you have to, then you might end up getting nothing</b>
  16. </form>


As you can see, some of them cannot be together, so in the end, it will not be 100 tutorials
  • Bogey
  • Bogey
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 8212
  • Loc: USA
  • Status: Offline

Post September 22nd, 2010, 11:58 pm

Oh, that makes sense :)

Still, if you use my first option, it's like 80+ pages :lol:
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • righteous_trespasser
  • Scuffle
  • Genius
  • User avatar
  • Joined: Mar 12, 2007
  • Posts: 6228
  • Loc: South-Africa
  • Status: Offline

Post September 23rd, 2010, 12:04 am

I think you're approaching this from the wrong angle ... Instead of submitting the form and creating a link from the post values, rather just include the correct files ... So in other words, create solution_1.html to solution_10.html files and just include them if necessary ... like so:

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>


checkbox-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. ?>
Let's leave all our *plum* where it is and go live in the jungle ...
  • BomWatchout
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Sep 20, 2010
  • Posts: 12
  • Status: Offline

Post September 23rd, 2010, 12:18 am

but as I said before, this checkboxes are not meant to give the user the direct tutorial link, they are meant to inform me of their current situation and from that I will grant them a tutorial.

If it were that easy I would do it long time ago :)
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post September 23rd, 2010, 12:18 am

Post Information

  • Total Posts in this topic: 22 posts
  • Users browsing this forum: No registered users and 174 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.