Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Warning: Use of undefined constant

Posted on 2003-10-31
12
Medium Priority
?
324 Views
Last Modified: 2006-11-17
I am using a php script for some purpose earlier it was running without any error but now it is displaying some errors mentioned below also an example of script is given.


<?php
$getty = $_GET[emladr];
echo $getty;
?>

it displays output as following


Warning: Use of undefined constant emladr - assumed 'emladr' in C:\W3Sites\dummyweb\www\msntr.php on line 2
hussainekazmi@hotmail.com

my page link is :

http://www.pindionline.net/msntr.php?emladr=hussainekazmi@hotmail.com

plese help me to resolve warning message why warning is displayed.

Thanks

0
Comment
Question by:hussaini
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
12 Comments
 

Accepted Solution

by:
keewooi earned 200 total points
ID: 9661909
should be
$getty = $_GET['emladr'];
0
 
LVL 3

Expert Comment

by:red010knight
ID: 9662919
Actually I would recommend $HTTP_GET_VARS['emladr']; over $_GET as it helps to secure the site a bit better.

Red010knight
0
 
LVL 11

Expert Comment

by:Zontar
ID: 9664253
>  Actually I would recommend $HTTP_GET_VARS['emladr']; over $_GET as it helps to secure the site a bit better.

The PHP Manual says that superglobals are preferred, and that the $HTTP_*_VARS arrays are deprecated and likely to go away in a future release. (You will be able to turn them off in PHP5. This isn't and won't be the case with superglobals.)
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Expert Comment

by:keewooi
ID: 9664941
Found this from PHP manual:

Since PHP 4.1.0, the preferred method for retrieving external variables is with the superglobals mentioned below. Before this time, people relied on either register_globals or the long predefined PHP arrays ($HTTP_*_VARS). As of PHP 5.0.0, the long PHP predefined variable arrays may be disabled with the register_long_arrays directive.
0
 
LVL 11

Expert Comment

by:Zontar
ID: 9664959
That's exactly what I was referring to, thanks.
0
 
LVL 3

Expert Comment

by:ashoooo
ID: 9716452
emladr should be in double or single quotes
0
 
LVL 3

Expert Comment

by:red010knight
ID: 9717018
Single, though I don't think that should actually matter in the code...

Red010Knight
0
 
LVL 3

Expert Comment

by:ashoooo
ID: 9717560
It wasnt a question.
0
 
LVL 11

Expert Comment

by:Zontar
ID: 9719389
Double, if you want to use variable interpolation:

$i = 2;
$_GET["something$i"] -->> $_GET["something2"]
$_GET['something' . $i] -->> $_GET["something2"]
$_GET['something$i'] -->> error (probably)

At any rate, keewooi pointed that out in the first response to this question.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question