j jl j jl - 2 years ago 84
PHP Question

PHP variable inside of HTML string value - Why won't it work?

Basically I'm a little confused to why this won't work, no errors or anything, it's just simply blank, it has worked before, but it's now deciding not to work it's just really strange.
This is what i'm trying to do:
This is what i'm trying to do: ($id does have a value and it's currently being echoed out on the page with no issue)

$id = $_SESSION['userid'];
<input type="submit" name="submit" value="<?php echo $id; ?>"/>

Answer Source

because you are missing ECHO command between <?PHP ?> tags

and in your HTML Code you are define <?PHP $id ?> but in your PHP code you don't have an ID you have

<input type="submit" name="submit" value="<?php echo $id; ?>"/>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download