0

I have created the following php

 <?php
if (isset($_GET["user_name"]) && !empty($_GET["user_name"])) {
        if(strtolower($_GET("user_name")) == "pulkit") {
            echo "Cool You are the Best";
        }
    }

?>

<form action="test1.php" method="GET">
Name: <input type="text" name="user_name"><br><br>
        <input type="submit" value="Submit">
</form>    

Now when i run the php i get the error :
Fatal error: Function name must be a string in C:\wamp\www\test\test1.php on line 3

Now the thing is the $_GET("user_name") is not giving the result as string. Why and how to fix it and get the username from the form. Any help would be apreciated

1
  • 8
    $_GET["user_name"] not $_GET("user_name"). Square brackets. Commented Nov 1, 2014 at 5:45

2 Answers 2

2

Change this line

if(strtolower($_GET("user_name")) == "pulkit") {

to this

if(strtolower($_GET["user_name"]) == "pulkit") {

its not $_GET("user_name") its hase to be $_GET["user_name"]

Sign up to request clarification or add additional context in comments.

Comments

0

Look your third line you have done a mistake while getting it should be like this

if(strtolower($_GET["user_name"]) == "pulkit") {

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.