Getting values from $_POST[''] or $_GET[''] problem ??
Moderator: General Moderators
Getting values from $_POST[''] or $_GET[''] problem ??
Hello everybody
is there anyway to get the values from the $_POST[] or $_GET[] from the single varibale ?
if anybody knows plz just jott it down..
is there anyway to get the values from the $_POST[] or $_GET[] from the single varibale ?
if anybody knows plz just jott it down..
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
- dibyendrah
- Forum Contributor
- Posts: 491
- Joined: Wed Oct 19, 2005 5:14 am
- Location: Nepal
- Contact:
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
- dibyendrah
- Forum Contributor
- Posts: 491
- Joined: Wed Oct 19, 2005 5:14 am
- Location: Nepal
- Contact:
Suppose, we have variable x for all GPC.
What will $_REQUEST['x'] will have now? Sorry, I have not tried that yet.
Code: Select all
<?php
$_POST['x']=1;
$_GET['x']=2;
$_COOKIE['x']=3;
?>
Last edited by dibyendrah on Fri Jan 12, 2007 7:30 am, edited 1 time in total.
-
brendandonhue
- Forum Commoner
- Posts: 71
- Joined: Mon Sep 25, 2006 3:21 pm
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
I beg to differ.brendandonhue wrote:I'm not sure what will happen with the cookie value, but you can't have both POST and GET in one HTTP request.
Code: Select all
<form action="?foo=bar" method="post">
<input name="bar" value="foo" />
<input type="submit" value="Submit" />
</form>- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
You can have $_GET, $_POST, $_SESSION and $_COOKIE all in one request.brendandonhue wrote:I'm not sure what will happen with the cookie value, but you can't have both POST and GET in one HTTP request. Take a look at $_SERVER['REQUEST_METHOD']
To answer the question about which comes where, try this...
Code: Select all
<?php
if (isset($_POST['send_form']))
{
echo '<h1>The Request value is: ' . $_REQUEST['foo'] . '</h1>';
}
setcookie('foo', 'cookieval');
?>
<form method="post" action="<?php echo basename($_SERVER['SCRIPT_FILENAME']); ?>?foo=getval">
<input type="text" name="foo" value="postval" />
<input type="submit" name="send_form" value="Check the Request value" />
</form>- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Find the directive in http://php.net/manual/en/ini.php
It lists where it can be altered. If you don't understand the constant, look at the bottom of the page.
You have a private message to read PHPycho.
It lists where it can be altered. If you don't understand the constant, look at the bottom of the page.
You have a private message to read PHPycho.