The following script checks to see if the user answer matches the correct answer.
Form Fields are set up the following way...
user_answer[$i] | value = a
user_answer[$i] | value = b
user_answer[$i] | value = c
all radio fields (above)
orgid[$i] | value = $i
answer[$i] | value = (a or b, c)
all hidden fields (above)
$i = question id/number
Basically when question answer isn't selected an undefined offset error message is generated. Adding if empty or isset messes up the order.
Code: foreach ($_POST['orgid'] as $k =>$v) {
$orgid[$k] = $v;
}
$k = 0;
$m = 0;
while ($k <= 19) {
if ($_POST['user_answer'][$k] == $_POST['answer'][$k]) {
$correct++;
unset ($_POST['user_answer'][$k]);
unset ($orgid[$k]);
} else {
$incorrect++;
}
$k++;
}
Any ideas/suggestions?
Error when call dll from oracle
Hi all, please help me!
pull content
I have an existing page, domain/adverts.php which has a good PR. I've just rebuilt my site and the new version of that page is now a couple of folders deep, at domain/subfolder/adverts/ads.php. I've
Inserting a check in checkbox from array value
Hello all,I have a bit of code that works for a select option box, but does not work for my checkboxes. I need multiple selections on this code and I really don't like the look of multiple select
ctype() validation - allowing illegal characters
Hello,I use ctype() to filter and validate a user form. However, I am trying to allow certain characters.Example:Code: //Validate Copay $allow = array('$', '.'); if (!empty($copay)
How do I give a developer access to a specific directory and nothing else?
I want to give a develop access to a specific directory and nothing elseI can give them an FTP account with access to a sub directory, but this doesn't exactly solve the problem!1. They can write PHP
Help please - How to validate from 2 possible answers
Hi I hope somebody can help me with what will probably be really simple, I'm pulling my hair trying to get my head round it.I've got a contact form and I would like to add to it a couple of simple
trim function issues
Hi guys, total noob here... So I've been tinkering around with a html and am using php to email the subitted data to me. It's all working fine, except now I've changed the rules of the form a little
Help with simple query
Hi, I'm trying to do a Query with a Union where I want to print the number of rows $tc contains. Can anyone see what's wrong with this:Code: $tc = @mysql_num_rows(mysql_query("(SELECT * FROM
Losing 'page' data
I have this code that allows me to update my database. But after updating, I lose the $_GET['page'] value in the browser. I need this value because it is passed when I go to other pages on the
How to separate records and ORDER BY
Let say i have 100 records and displayed in one page, then i want to get the records from 50-100 and use ORDER BY to re-order whether DESC or ASCHow can i do the ORDER BY without re-order first 50