am getting an error wen i run the following code am saving it as welcome.php
and using wammp

Welcome <?php echo $_GET["fname"]; ?>!<br />
You are <?php echo $_GET["age"]; ?> years old.


ERROR

Welcome
Notice: Undefined index: fname in C:\wamp\www\welcome.php on line 4
!
You are
Notice: Undefined index: age in C:\wamp\www\welcome.php on line 5
years old.

Recommended Answers

All 2 Replies

It is not error its just a warning. if this is displayed on your browser then you need to modify your php.ini
find

display_errors = On
set it to
display_errors = Off

restart apache.

Member Avatar for rajarajan2017

Test with single quotes and also confirm whether you have fname and age in the address bar (ie. query string)

Welcome <?php echo $_GET['fname']; ?>!<br />
You are <?php echo $_GET['age']; ?> years old.
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.