I'm using sockets.io, express and php and I was wondering if it is possible to push something of a page (that only a specific user can see at the time) to another page other can see. For example, if an admin has:

<?php $a = $row['test']; //data from test table
$q = '<h2>'.$a.'</h2>';
$b = $row['options']; //data from answers table
$c = '<label"><input type="radio" name="radio" value="'.$b.'" onclick="">'.$a.'</label>
$output = ''.$a.','.$c.',<input type="submit" name="submit" value="submit">';
        echo $output

So this outputs as a question with radio buttons as options for the client to choose from. Is it possible for this to be pushed to the client. Like the admin will push first question and then the next, etc. I'm new to webscokets but I'm getting a hang of it but this is really cracking my brain. Any ideas will be really helpful. At the moment, I'e gotten the normal user to be able to view the contents as set by the admin. Now, my problem is the admin controlling how the data is sent to the user/client. I have a button now that when a user presses next, the next data/question comes but I'd like for the admin to be able to control that. Like when the user submits the first data, the page loads and waits for the admin to push the next question.

Recommended Answers

All 2 Replies

This is not good idea what you want. You are making life of admin difficult.

But still it is possible
In user_quiz table , you can keep column last_question_sent

So the moment user submits question, admin will see on his screen the last question submitted by all users.

On admin screen you can allow button for each user "send next question", so it willl increment last_qustion_sent against user's record

Now you can keep timer in javascript/jquery of user screen that will check the status of users question, if it is allowed by admin, next question can be displayed to user.

All above step can be repeated for whole quiz

Seeing live results wouldn't be worth anything IMO. I'd rather just have the final results.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.