Difference between revisions of "PHP 4"
From Ilianko
(→COOKIE) |
|||
Line 23: | Line 23: | ||
== COOKIE== | == COOKIE== | ||
+ | |||
+ | <code><pre> | ||
+ | <?php | ||
+ | |||
+ | echo 'old: '; | ||
+ | print_r($_COOKIE['user']); | ||
+ | |||
+ | echo '<br /> new: '; | ||
+ | print_r($_POST['user']); | ||
+ | ?> | ||
+ | |||
+ | <form method=POST> | ||
+ | <input type=text name=user> | ||
+ | <input type=submit name=button value="natisni"> | ||
+ | </form> | ||
+ | </pre></code> | ||
<?php | <?php | ||
− | setcookie(" | + | setcookie("user", $_POST['user']); |
+ | |||
+ | ?> | ||
+ | </pre></code> | ||
+ | |||
+ | == SERVER == | ||
+ | |||
+ | <?php | ||
+ | |||
+ | print_r($_SERVER) | ||
+ | |||
+ | ?> | ||
+ | |||
+ | == SESSION == |
Revision as of 14:25, 20 October 2013
GET
<?php print_r($_GET) ?>
POST
<?
print_r($_POST)
?>
<form method=POST>
<input type=text name=user>
<input type=submit name=button value="natisni">
</form>
COOKIE
<?php
echo 'old: ';
print_r($_COOKIE['user']);
echo '<br /> new: ';
print_r($_POST['user']);
?>
<form method=POST>
<input type=text name=user>
<input type=submit name=button value="natisni">
</form>
<?php
setcookie("user", $_POST['user']);
?>
SERVER
<?php
print_r($_SERVER)
?>