1

I am trying to understand this syntax <?=$value;?> in php, For example:

<input type="text" name="user" value="<?=$_POST["user"];?>" id="user">

As i understand it is not some xml syntax becouse the file has to be .php file, Also the:

<? ?> // short opening tags in the <?=$_POST["user"];?> syntax

Is working even if i set short_open_tag = Off, If anyone can please help me understand this syntax and how doe's it working with the short_open_tag = Off, Thank you all and have a nice day.

4
  • short_open_tag is depreciated..please dont use that Commented Mar 7, 2013 at 10:42
  • it's an implicit PHP echo (example #2, number 3) php.net/manual/en/language.basic-syntax.phpmode.php - see notes for short open tags Commented Mar 7, 2013 at 10:42
  • Is there an alternative for the sort_open_tag? Commented Mar 7, 2013 at 10:43
  • I think that means <? echo $_POST["user"]; ?> Commented Mar 7, 2013 at 10:43

4 Answers 4

3

try

<input type="text" name="user" value="<?=$_POST['user'];?>" id="user" />

You forget " .

And <?=$_POST['user'];?> is the simple and short form of <?php echo $_POST['user']; ?>

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

Comments

1

The <?=$value;?> is short-hand syntax for <?php echo $value; ?>.

As to why it works even with short_open_tags turned off; are you using PHP >=5.4.0? If so, that's expected; it's always available. See here.

1 Comment

Thank nyou Michael, this is the link i was looking for.
1
<input type="text" name="user" value=<?=$_POST["user"];?> id="user">

value=<?=$_POST["user"];?>

Means the value you entered in the input field with name 'user' and submitted.

Comments

1

<? ?> is the same as <?php ?>. Since they are inserting a php value $_POST["user"] into the Form they are using the <? ?>

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.