Jump to content

bassplaya4string

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

bassplaya4string's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Is there a way to do this? If so, any code snippets and/or tutorial links would be greatly appreciated!
  2. This may sound uber n00b, BUT here it goes.... I get how to set a loop to pull ALL of the data in a table, but how would I pull just one field of data? All of the tuts I am seeing online only show how to loop through everything. Any help would be greatly appreciated! Thanks in advance!
  3. GuiltyGear, you are the man! Thanks a lot for the help!
  4. Thanks a lot for the advise!!! I like the idea of keep it separate from the main table. Can someone give me an example on how to copy the data to the archive table before deleting it from the main table?
  5. I am making a site that uses a while loop to fetch all of the entries that have been posted in a MySQL database. I have a script that removes the entries, but it deletes them from the database. What is the best way to remove the entry from the main list, but not have it deleted from the DB. My ultimate goal is to create a page called archives.php and have all of the posts from the main list that have been removed shown there. Any help/ideas would be greatly appreciated!
  6. Never-mind, human error, I noticed I was not echoing out some fields!! Solved!
  7. I need someone to help me out with this issue I have never had before with a simple form. Ok, what's going on is that some variables are saving to the database and some aren't. I have done a var_dump and all of the variables are passing correctly, it's just not saving to the database. I have checked SEVERAL times to make sure all the variables/quotations/syntax/commas are correct. ??? Crazy sounding I know, but any help would be much appreciated!
  8. I switched them but it came back with this error now parse error, unexpected T_IS_SMALLER_OR_EQUAL [code] if ($score <= 3){ $image1 = "<img src = 'images/0-3.jpg'>"; } else if ($score >= 4 && <= 7){ $image2 = "<img src = 'images/4-7.jpg'>"; } else ($score >= 8 && <= 10){ $image3 = "<img src = 'images/8-10.jpg'>"; } } } [/code]
  9. anybody see anything wrong with this code? [code]if ($score < 3){ $image1 = "<img src = 'images/0-3.jpg'>"; } else ($score => 4 && =< 7){ $image2 = "<img src = 'images/4-7.jpg'>"; } else ($score => 8 && =< 10){ $image3 = "<img src = 'images/8-10.jpg'>"; }[/code]
  10. I have a quiz that has 10 questions. When the user fills out all of the radio buttons, an evaluation will come up along with the correct answers. my problem is every time someone completes a quiz, under the evaluation the quiz is still visible here is my code [code] <?php $questions = array($_POST["Q_1"], $_POST["Q_2"], $_POST["Q_3"], $_POST["Q_4"], $_POST["Q_5"], $_POST["Q_6"], $_POST["Q_7"], $_POST["Q_8"], $_POST["Q_9"], $_POST["Q_10"],); if (!isset($_POST['submit'])) { // if page is not submitted to itself echo the form } else { $i = 0; $throw = false; while ($i < 10){ if ($questions[$i] == null) { $throw = true; } $i++; } if ($throw){ $error = "Please answer all of the  questions."; } else { $score = $Q_1 + $Q_2 + $Q_3 + $Q_4 + $Q_5 + $Q_6 + $Q_7 + $Q_8 + $Q_9 + $Q_10; $complete = "<span class='h5'>Your score is ".$score.".</span><br />"; $description = "<span class='h2'>EXPLANATION</span><br /><br />... [/code] then above the form I have this... [code] <font color="red"><? print ($error); ?></font><br />   <? print ($complete); ?><br />   <? print ($description); ?> <!-- start of form -->                        <form method="post" action="<? $PHP_SELF ?>">                         <span class="h2">1. True leaders are born, not made.</span><span class="body"><br>                           True:                           <input value="0" name="Q_1" type="radio">                           False:                           <input value="1" name="Q_1" type="radio">... [/code]
  11. I created a form with 10 radio buttons, if the user misses one of the buttons after clicking submit, I want an error message to come up. I got it working except the error message always comes up even if they have selected all of the radio buttons....here is my code....can someone please help!? [code] } else { $i = 0; $throw = false; while ($i < 10) { $questions[$i] == null; $throw = true; $i++; } if ($throw) { echo "It appears that you missed one of the questions. Please hit the back button and return to the quiz.<br />"; } [/code]
  12. I tried that and it can back with the same error as before: Parse error: parse error, unexpected T_WHILE in /home/content/H/a/l/HaloWeb/html/test.php on line 59. I think something is wrong with the while loop. Like I said before I am fairly new to php, so please be patient. Thanks!
  13. I am trying to make a simple little survey that calculates the total score and if a field is left empty, it will return to the survey. All is well except the while statement near the end. I cant get it to return to the form if a question is not answered. can someone please take a look at it and help me out. I know this may seem elementary to some but I am only starting to use php alot. Thanks! [code] <?php $questions = array($_POST["Q_1"], $_POST["Q_2"], $_POST["Q_3"], $_POST["Q_4"], $_POST["Q_5"], $_POST["Q_6"], $_POST["Q_7"], $_POST["Q_8"], $_POST["Q_9"], $_POST["Q_10"],); if (!isset($_POST['submit'])) { // if page is not submitted to itself echo the form ?> <html> <head> <title>Test</title> </head> <body> <form method="post" action="<?php echo $PHP_SELF;?>"> 1. True leaders are born, not made.<br /> True:<input type="radio" value="1" name="Q_1"><br /> False:<input type="radio" value="0" name="Q_1"><br /> <br /> 2. If I take on a leadership role, I’ll improve my popularity.<br /> True:<input type="radio" value="1" name="Q_2"><br /> False:<input type="radio" value="0" name="Q_2"><br /> <br /> 3. The very best leaders know the value of keeping a low profile.<br /> True:<input type="radio" value="1" name="Q_3"><br /> False:<input type="radio" value="0" name="Q_3"><br /> <br /> 4. If you usually get along well with those in charge, you will probably be a good leader.<br /> True:<input type="radio" value="1" name="Q_4"><br /> False:<input type="radio" value="0" name="Q_4"><br /> <br /> 5. The best leaders always know what to do. <br /> True:<input type="radio" value="1" name="Q_5"><br /> False:<input type="radio" value="0" name="Q_5"><br /> <br /> 6. An effective leader must try to maintain a forceful personality.<br /> True:<input type="radio" value="1" name="Q_6"><br /> False:<input type="radio" value="0" name="Q_6"><br /> <br /> 7. My physical appearance has little or nothing to do with my becoming a leader.<br /> True:<input type="radio" value="1" name="Q_7"><br /> False:<input type="radio" value="0" name="Q_7"><br /> <br /> 8. I prefer reading fiction to nonfiction.<br /> True:<input type="radio" value="1" name="Q_8"><br /> False:<input type="radio" value="0" name="Q_8"><br /> <br /> 9. I usually stick to my decision even when it is unpopular with my group.<br /> True:<input type="radio" value="1" name="Q_9"><br /> False:<input type="radio" value="0" name="Q_9"><br /> <br /> 10. Being a quick decision-maker is an important trait of a good leader. <br /> True:<input type="radio" value="1" name="Q_10"><br /> False:<input type="radio" value="0" name="Q_10"><br /> <br /> <input type="submit" value="submit" name="submit"> </form> <? } else { $i = 0 while ($i < 10) { $questions[$i] != null; $i++; } $score = $Q_1 + $Q_2 + $Q_3 + $Q_4 + $Q_5 + $Q_6 + $Q_7 + $Q_8 + $Q_9 + $Q_10; echo "Your score is ".$score.".<br />"; } ?> [/code]
  14. Thanks man! That helps! if you can find that example test maker that would be awesome! (if anyone knows of a tutorial that I could take a look at, please, post a link. Thanks!) [quote author=printf link=topic=110835.msg448702#msg448702 date=1160262733] I think I have example test maker around here some where, if I can remember what computer it is on, I'll look and post back in a little bit! me! [/quote]
  15. I am trying to make 2 quizzes, each will have 10 questions when you answer them you will get a score and what your score means and if you forget to answer one it will ask you to go back and answer it. I was wondering what the easiest way to do this with PHP is. Any help would be greatly appreciated!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.