Hi, I have a very simple php page abc.php like this:
<?php
$Module_id = $_POST['module_id'];
echo $Module_id;
?>
However, when I type http://localhost/abc.php?module_id=1,
I got this error:
"Undefined index: module_id in abc.php"
Can someone tell me what is wrong?
Thanks.
Jie Huang
Undefined index??
Moderator: General Moderators
appending parameters to the url is called GET-method.
PHP stores them in $_GET
http://www.php.net/manual/en/reserved.v ... iables.get
PHP stores them in $_GET
http://www.php.net/manual/en/reserved.v ... iables.get
Re: Undefined index??
$_POST only works on POSTed information. When the information is part of the URL, use $_GET. For example :-jiehuang001 wrote:Hi, I have a very simple php page abc.php like this:
<?php
$Module_id = $_POST['module_id'];
echo $Module_id;
?>
However, when I type http://localhost/abc.php?module_id=1,
I got this error:
"Undefined index: module_id in abc.php"
Can someone tell me what is wrong?
Thanks.
Jie Huang
Code: Select all
<?php
$Module_id = $_GET['module_id'];
echo $Module_id;
?>