PHP - what is the proper way to do inline HTML variable output?

Posted by edmicman on Stack Overflow See other posts from Stack Overflow or by edmicman
Published on 2010-04-23T01:56:47Z Indexed on 2010/04/23 2:03 UTC
Read the original article Hit count: 323

Filed under:
|

I just moved from an Ubuntu PHP workstation dev environment back to Windows and am using xampp. I have a bit of code, like so:

<input type="text" name="txtEmail" value="<?=$emailaddress;?>"/>

that I swear worked to display the variable in the textbox when I was developing before. But when I loaded the page on Windows/xampp it just put that text between the quotes in the textbox. Instead, I ended up changing it to something like:

<input type="text" name="txtFirstName" value="<?php echo($firstname);?>" />

The latter makes sense, but I guess I thought there was a shorthand or something, and I must be going crazy because I'm sure the first way was working on a difference environment.

So what's the best way to do this?

© Stack Overflow or respective owner

Related posts about php

Related posts about html