Sometimes own parameters should be sent together with poll results.
For example, let’s say a page with poll on your site is available for signed up and logged in users only and you know internal user_id of the user participating in poll. In this case, you can send this user_id to the poll and it will be returned to your script (or JS function) with poll results. Besides, this parameter will be saved in report on the respondent for viewing in personal account at Simpoll. So you will be able to define to what user received answers belong.
To send any parameters of the poll you should:
Example of sending parameters to the poll:
<?php // Array of parameters to be sent // to our site after passing the poll. // It can be formed dynamically, if necessary. $params_arr = array( 'user_id' => 123, 'user_login' => 'anonymous' ); // Create URL-coded inquiry line $params_str = http_build_query($params_arr); ?> <!—Create a field with inquiry line --> <input type="hidden" id="simpoll_params" value="<?php echo $params_str; ?>" /> <!—Connect the poll --> <script type="text/javascript" src="http://simpoll.pro/embed/framejs/aa7ca07e"></script>
Hidden field should have identifier simpoll_params.
Connection of the poll in page body should be strictly below the hidden field, otherwise parameters won’t be sent.
After passing the poll, Simpoll will send transferred parameters with poll results to Result URL (or to callback function)
Example of Simpoll response:
POST: ( [user_id] => 123 [user_login] => anonymous [sp_survey_id] => 551 [sp_survey_key] => aa7ca07e [sp_resp] => Array ( [id] => 172693 [ip_addr] => 127.0.0.1 [name] => Respondent No.172693 [time_start] => 2011-12-13 13:23:24 [time_end] => 2011-12-13 13:23:45 [time_delta] => 00:00:21 [quiz_passed] => 0 [quiz_percent] => 33 [quiz_correct] => 3 [quiz_wrong] => 2 ) [sp_result] => 1 [sp_answers] => Array ( [1] => Array ( [0] => Italy ) [2] => Array ( [0] => Pyramids [1] => Kremlin [2] => Colosseum [3] => Eifel tower ) ) )
Other parameters are identical to those described in 3.2.
If you don’t insert the poll to site page, but provide users with direct link to it, you still will be able to send parameters to poll through its URL.
Example of URL with parameters:
http://simpoll.pro/run/survey/aa7ca07e?userid=123&userlogin=anonymous
All sent parameters are saved in poll results for every respondent separately.
When viewing parameters of certain respondent in personal account at Simpoll, these parameters will be shown in column at the right.