Thanks very much again for your help,
I've tried toe code you suggested but unfortunately it still outputs the same problem as my own code, I tried the following code:
[PHP] // Validate the The Insertion of all answers -- check that they dont equal NULL
// Query all the answers
$check_answers = "SELECT question_id FROM questions as qid ORDER BY question_id ASC";
...
User Profile
Collapse
-
Again thank you for replying, What do you recommend?, I believe as I am declaring the variable locally inside the if statement it is not considered in the else part. I have tried declaring it outside but it doesnt seem to help!
Nabz...Leave a comment:
-
Firstly thanks for replying, Secondly it does work it for some reason in the error message it states the qid inside the item is undefined. This is only for the else part of my statement and not any other which is strange.
My questionnaire is meant to be dynamic hence the reason for calling the array of answers known as $item the qid inside of this uniquely identifies each answer to each question it works for the submit perfectly...Leave a comment:
-
Simple questionnaire validation problem
Hi
guys Ive got a simple problem, im designing an online questionnaire and on submission the coding that I have used to validate whether a user has filled in all the questions is supposed to identify any questions they have missed out and print out a simple error message.
It correctly identify which questions have not been filled in but returns the following error message too:
.
.
... -
-
Hi thanks for the reply Ive tried that previously and once again and although no error message comes up nothing gets inserted into the table.
[PHP]The following is the code ive used:
if (isset($_POST['answers']) && is_array($_POST['answers']))
{
foreach($_POST['answers'] as $user_answers){
echo "Value: $user_answers<b r>\n";
if (isset($_POST['question'])...Leave a comment:
-
Multiple MYSQL INSERT statement
Hi Im doing a questionnaire in PHP and MYSQL
I am trying to do a multiple insert using the following code
[PHP]$query1 = "INSERT INTO answers (answer_score,q uestion_id,user _id) VALUES ('$item1','$que stion[0]','$user_id_for eign'), ('$item2','$que stion[1]','$user_id_for eign')";[/PHP]
But it will only insert the first value and not the second. I have tested the mysql bit of coding in mysql itself... -
Hi thanks again for replying Ive tried the code you suggested but its still not inserting all the answers I still get the following:
Value: 7
The Answer did not submit: Query was emptyValue: 7
The Answer did not submit: Query was emptyValue: 7
The Answer did not submit: Query was emptyValue: 7
The Answer did not submit: Query was emptyValue: 7
The Answer did not submit: Query was emptyValue: 7...Leave a comment:
-
Cheers for your help mate I gave it a go but unfortunately still cant get it to collect all the answers except the first string.
[PHP]$answer = array();
$answer[0] = $item1;
$answer[1] = $item2;
$answer[2] = $item3;
$answer[3] = $item4;
$answer[4] = $item5;
$answer[5] = $item6;
$numElements = count($answer); //this counts the elements
for ($i = 0; $i < $numElements;...Leave a comment:
-
Hi guys thank you both for replying I want to individually store each string value in the database as an individual answer. (answers range from 0 to 7)
The flollowing code is where how im printing my questionnaire on screen
[PHP]//Fetch and print the questionnaire.
$counter = 1;
while ($row = mysql_fetch_arr ay($result,MYSQ L_BOTH)) {
echo '<tr><td align="left">'. $counter....Leave a comment:
-
arrays and for loop problems
Hi there guys
Im having a bit of a problem storing the values of some strings called $item1 ...$item6 (they are numbers from a radio button in a questionnaire, each item represents an answer for each question)
I want to put them in an array so when I use a For Loop I can whiz through them and put them into a variable which can then be put into an insert statement in mysql. (The MYSQL is looped depending on how many... -
Looping a MYSQL INSERT statement for a questionnaire tools answers
Can PHP help with the following as I have tried in the MYSQL Forums and cant get any help
Thanks
Nabz
----------------------------------------
Hi I am developing a PHP MYSQL questionnaire tool.
The problem I am having is that of inserting all the answers into the table. The questionnaire is Dynamic so the number of questions can vary. I have a variable that counts them so at the moment there...
No activity results to display
Show More
Leave a comment: