skip to Main Content

I have simple php script that contains this part:

$user = '<input type="text" name="name1" id="username" value="'.$firsttext.'">';
echo $user;

Do someone know how to get the text from the field? Thanks

I tried

echo $_GET['username']; 

I am noob in php

1

Answers


  1. $user = '<input type="text" name="name1" id="username" value="'.$firsttext.'">';
    echo $user;
    

    To retrieve the value using $_GET:

    $firsttext = $_GET['name1']; 
    echo $firsttext;
    

    Make sure that the name attribute of the input field and the key used in $_GET match. In this case, you should use $_GET[‘name1’] to access the value of the "name1" input field.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search