This chapter shows you the main functions of PHP-Code Elements which can be used. The Introduction in PHP-Code will help you to integrate all PHP functions for your questionnaire.
At the very end of this page will be a helpful information how the documentation of the PHP-functions can be read: Function in Detail
See also filter questions und filters.
value() – Use answer of participant, e.g. for a filter questiongoToPage() – Jump to another page immediatelygoToPage('end') – End the current interviewrepeatPage() – Show recent page againredirect() – Redirect the respondent to a different websitequestion() – Display a question within the questionnairetext() – Display a text element within the questionnaireshow() – Display a question, combined question or text or activate a feature elementdebug() – Show content of a data or PHP variableoption() – Modify page display settings (buttons, progress bar)preset() – Preset a response for a questionmarkFail() – Set the marker “response missing” for an inputhtml() – Output of HTML-Code within questionnairetextlink() – Create a hyperlink that shows a text element in a pop-up windowbuttonToPage() – Button to jump within the questionnairebuttonCode() – Create-HTML-Code for next/back buttonbuttonHide() – Do not show back/next buttons at the page's bottomlibrary() – Make a JavaScript or PHP library availablepageCSS() – Add CSS instructions to a single questionnaire pagepageHead() – Store meta-information about the questionnaire pageSoSci Survey supports several functions for random sampling or random group assignment (Randomization).
put() – Save a value in the data setrandom() – Dice a random number (with replacement)random_p() – Random number in correlation to likelihoodrandom_items() – Randomly select items from a listrandomUse() – Storing slips of paper from a random number generatorurnDraw() – Draw out from urn (random selection without replacement)urnPutAway() – Put away the chit drawn via urnDraw()urnStatus() – Retrieve current status of an urnreplace() – Prepare a placeholderregisterVariable() – Register PHP-Variable for following sitesid() – Create a question or variable label from it's componentsgetItems() – Order items of question by selected rulesgetQuestions() – Enlist a section's questionsgetItemtext() – Retrieve the text of a specific items or optiongetValueText() – Retrieve the label of a response code/optiongetTextElement() – Retrieve the content of a text elementgetVariables() – Return a list of variables from the datasetserialCheck() – Ask for serial numberreadGET() – Read converted variable from linksendJSON() – Send HTTP request in JSON format (REST API)sendPOST() – Send HTTP request in POST format (REST API)sendXML() – Send HTTP request in XML format (REST API)setNextPage() – Set side for click on ,,go further“setPageOrder() – Change the order to display subsequent questionnaire pages loopPage() – Show a page multiple times in a looploopToPage() – Show multiple pages multiple times in a looppageStop() – Do not show any further contents on the questionnaire pagesetLanguage() – Change languagebuttonDataCode() – Add a custom button on the page that sends additional informationbuttonDataGet() – Get the data sent via buttonDataCode()* ''[[:en:create:functions:info]]'' – Meta informationen int the current case or output configuration * ''[[:en:create:functions:infovars]]'' -- Information on variables in the dataset * ''[[:en:create:functions:getroute|getRoute()]]'' -- Tell if the next or back button was hit previously * ''[[:en:create:functions:casenumber|caseNumber()]]'' -- Number of actual interviews * ''[[:en:create:functions:caseserial|caseSerial()]]'' -- Serial number used in interview * ''[[:en:create:functions:casetime|caseTime()]]'' -- Show length of stay on one or more sites * ''[[:en:create:functions:casetoken|caseToken()]]'' -- Identification of interview * ''[[:de:create:functions:casedata]]'' -- Get all data collected in the current interview * ''[[:en:create:functions:reference|reference()]]'' -- Ask for reference (within link to questionnaires) * ''[[:en:create:functions:getanswermissing|getAnswerMissing()]]'' -- Information for site repeat if questions was obligated * ''[[:en:create:functions:listfails|listFails()]]'' -- List of not responded obligation questions * ''[[:en:create:functions:getlanguage|getLanguage()]]'' -- Determine language
goToQuestionnaire() – Jump from one Questionaire to the next (once)goToParent() – Go back to the formerly QuestionairemultiLevelDown() – Start a sub-questionaire inside the main questionaire (if necessary also several times)multiLevelData() – Get data specified in multiLevelDown()multiLevelReturn() – Return from the sub-questionnaire to the main questionnaire multiLevelResponse() – Get data specified in multiLevelReturn() multilevelput – Write a value directly into the higher-level recordmultiLevelURL() – Create a URL for a sub-questionnaire to be used latermultiLevelPrepare() – Create a sub-case to be used with a Multi-Level Listing and preset datadbGet() – Read data from date basedbKeys() – List key for data basedbLoad() – Call all entries with defined prefix from the contents database dbRetrieve() – Get data from the data base (associative, nested array)dbSet() – Safe data in data basedbStore() – Store data in the data base (associative, nested array)dbTouch() – Refresh time-stamp for data base entrydbDelete() – Delete entries from the data base, selected by a prefixdropValue() – Delete a single variable from the current interviewdropupload – Delete a file uploaded by the respondentdropCase() – Mark the current interview for deletiondropHistory() – Delete the page history of the current interviewstatistic() – Simple statistical analysis of all datadiagram() – Simple diagram (e. g. frequency) for all analyzed dataanswers() – Show a question including the respondent's answersanswersPrint() – Display all questions of a questionnaire segment including the respondent's answersvalueSum() – Compute sum over scale or variablesvalueMean() – Compute mean over scale or variablevalueSD() – Compute standard deviation over scale or variablevalueVar() – Compute variance over scale or variablevalueList() – Get multiple responses to multiple items in a question as arrayconvertDateTime() – Convert date/time texts (strings) and timestampscalcMean(), calcSD(), ... – Simple calcuations based on the current interview's responsesuploadAsTable() – Get am Excel or CSV table uploaded by the respondent as arraydiagram2() – Create diagram with set datagetQRCodeImage() – Integrate QR Code in the questionnaireimagepng_embed() – Include a PNG graphic without storing it to a filemailResume() – Resume an interview after a given delaymailSchedule() – Schedule to send a mailing to a single recipientmailRevoke() – Cancel a scheduled mailingpanelData() – Resolve information on the address recordpanelAdd() – Create a new address recordpanelData() – Get information from an existing address entrypanelUpdate() – Update information on the address recordpanelDelete() – Delete records from the address listaccessCount() – Limit trial to enter a codesetStatus() – Set the interview status and eventually trigger panel redirectsPHP provides a number of helpful functions, which can easily be used during questionnaire PHP Manual documented.
Some functions pose a security risk or do not work as expected in the context of the questionnaire. Alternatives are listed below. If you need additional features, please let SoSci Survey know.
echomysqld_query()Reference-syntax for each function, e.g.:
void set(mixed Value, [string Memory])
This reference-syntax describes the argumentation of functions and it's data type.
set() has o have at least one argument Value than it is allowed to use another (second) argument Memory .