Form Demo
Questions:
Can you get data in both
$_GET
and
$_POST
at the same time? If so, how. If not, why not?
What happens if you leave a text box empty?
Can you "unselect" all the radio buttons? If so, how. If not, why not?
Can you select "Fred" and "Barney" at the same time? Can you select "Barney" and "Trumpet" at the same time? What's the difference?
What happens if you unselect all the check boxes?
How does PHP treat checkboxes differently when doing a POST than when doing a GET?
How can you tell which submit button was pushed?
GET form
"text" type input named
theTopOne
"text" type input named
theSecondOne
Radio buttons named "flintstones": Fred
Barney
Value for Input #2 Wilma
Radio buttons named "instruments": Saxophone
Trumpet
Piano
Checkboxes named "courses": 451
452
457
Contents of
$_GET
Key
Value
POST form
"text" type input named
theFirstPost
"text" type input named
theSecondPost
Radio buttons named "interest": Cool
OK
Boring
Radio buttons named "bestState": Georgia
Michigan
California
Checkboxes named "IScourses": 260
333
463
Contents of
$_POST
Key
Value
array(73) { ["USER"]=> string(6) "apache" ["HOME"]=> string(16) "/usr/share/httpd" ["SCRIPT_NAME"]=> string(21) "/kurmasz/formDemo.php" ["REQUEST_URI"]=> string(21) "/kurmasz/formDemo.php" ["QUERY_STRING"]=> string(0) "" ["REQUEST_METHOD"]=> string(3) "GET" ["SERVER_PROTOCOL"]=> string(8) "HTTP/1.1" ["GATEWAY_INTERFACE"]=> string(7) "CGI/1.1" ["REMOTE_PORT"]=> string(5) "62672" ["SCRIPT_FILENAME"]=> string(33) "/www/faculty/kurmasz/formDemo.php" ["SERVER_ADMIN"]=> string(14) "root@localhost" ["CONTEXT_DOCUMENT_ROOT"]=> string(12) "/www/faculty" ["CONTEXT_PREFIX"]=> string(0) "" ["REQUEST_SCHEME"]=> string(5) "https" ["DOCUMENT_ROOT"]=> string(12) "/www/faculty" ["REMOTE_ADDR"]=> string(13) "172.70.134.32" ["SERVER_PORT"]=> string(3) "443" ["SERVER_ADDR"]=> string(13) "35.39.204.162" ["SERVER_NAME"]=> string(26) "faculty.computing.gvsu.edu" ["SERVER_SOFTWARE"]=> string(55) "Apache/2.4.37 (Red Hat Enterprise Linux) OpenSSL/1.1.1k" ["SERVER_SIGNATURE"]=> string(0) "" ["PATH"]=> string(49) "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin" ["HTTP_CDN_LOOP"]=> string(19) "cloudflare; loops=1" ["HTTP_CONNECTION"]=> string(10) "Keep-Alive" ["HTTP_CF_IPCOUNTRY"]=> string(2) "US" ["HTTP_CF_VISITOR"]=> string(18) "{"scheme":"https"}" ["HTTP_TRUE_CLIENT_IP"]=> string(14) "18.118.195.186" ["HTTP_ACCEPT"]=> string(3) "*/*" ["HTTP_X_FORWARDED_PROTO"]=> string(5) "https" ["HTTP_USER_AGENT"]=> string(103) "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0;
[email protected]
)" ["HTTP_ACCEPT_ENCODING"]=> string(8) "gzip, br" ["HTTP_CF_CONNECTING_IP"]=> string(14) "18.118.195.186" ["HTTP_HOST"]=> string(26) "faculty.computing.gvsu.edu" ["HTTP_X_FORWARDED_FOR"]=> string(14) "18.118.195.186" ["HTTP_CF_RAY"]=> string(20) "91ddf9c9897d57ac-IAD" ["proxy-nokeepalive"]=> string(1) "1" ["SSL_SESSION_RESUMED"]=> string(7) "Initial" ["SSL_SESSION_ID"]=> string(64) "2bb0e2170187dc02bfbfd61b17becf3a5f5e619159dacaa2e33abec24dec89af" ["SSL_SERVER_A_SIG"]=> string(23) "sha256WithRSAEncryption" ["SSL_SERVER_A_KEY"]=> string(13) "rsaEncryption" ["SSL_SERVER_I_DN"]=> string(55) "CN=DigiCert TLS RSA SHA256 2020 CA1,O=DigiCert Inc,C=US" ["SSL_SERVER_S_DN"]=> string(84) "CN=*.computing.gvsu.edu,O=Grand Valley State University,L=Allendale,ST=Michigan,C=US" ["SSL_SERVER_V_END"]=> string(24) "Aug 11 23:59:59 2023 GMT" ["SSL_SERVER_V_START"]=> string(24) "Aug 11 00:00:00 2022 GMT" ["SSL_SERVER_M_SERIAL"]=> string(32) "0C78932C0C1B2C56DE11AC19BF8E55D6" ["SSL_SERVER_M_VERSION"]=> string(1) "3" ["SSL_CLIENT_VERIFY"]=> string(4) "NONE" ["SSL_CIPHER_ALGKEYSIZE"]=> string(3) "256" ["SSL_CIPHER_USEKEYSIZE"]=> string(3) "256" ["SSL_CIPHER_EXPORT"]=> string(5) "false" ["SSL_CIPHER"]=> string(22) "TLS_AES_256_GCM_SHA384" ["SSL_COMPRESS_METHOD"]=> string(4) "NULL" ["SSL_SECURE_RENEG"]=> string(5) "false" ["SSL_PROTOCOL"]=> string(7) "TLSv1.3" ["SSL_VERSION_LIBRARY"]=> string(14) "OpenSSL/1.1.1k" ["SSL_VERSION_INTERFACE"]=> string(14) "mod_ssl/2.4.37" ["SSL_SERVER_SAN_DNS_1"]=> string(18) "computing.gvsu.edu" ["SSL_SERVER_SAN_DNS_0"]=> string(20) "*.computing.gvsu.edu" ["SSL_SERVER_I_DN_CN"]=> string(32) "DigiCert TLS RSA SHA256 2020 CA1" ["SSL_SERVER_I_DN_O"]=> string(12) "DigiCert Inc" ["SSL_SERVER_I_DN_C"]=> string(2) "US" ["SSL_SERVER_S_DN_CN"]=> string(20) "*.computing.gvsu.edu" ["SSL_SERVER_S_DN_O"]=> string(29) "Grand Valley State University" ["SSL_SERVER_S_DN_L"]=> string(9) "Allendale" ["SSL_SERVER_S_DN_ST"]=> string(8) "Michigan" ["SSL_SERVER_S_DN_C"]=> string(2) "US" ["SSL_TLS_SNI"]=> string(26) "faculty.computing.gvsu.edu" ["HTTPS"]=> string(2) "on" ["UNIQUE_ID"]=> string(27) "Z84U0-aduvcWScMWmxckigAAAMY" ["FCGI_ROLE"]=> string(9) "RESPONDER" ["PHP_SELF"]=> string(21) "/kurmasz/formDemo.php" ["REQUEST_TIME_FLOAT"]=> float(1741558995.4719) ["REQUEST_TIME"]=> int(1741558995) }