user13686997
user13686997

Reputation:

How do I echo input value in a php script?

how it looksI need to set an input value in a php script

<php
<input value="<?php echo $_SESSION['logged_user']->login; ?>">
?>

As you might understand my does not work

Upvotes: 0

Views: 155

Answers (1)

David
David

Reputation: 219106

Your PHP syntax is very confused. While inside of a <?php ?> section you're trying to directly write HTML, and trying to open another <?php ?> section.

Either get rid of the enclosing section:

<input value="<?php echo $_SESSION['logged_user']->login; ?>">

Or keep the enclosing section and use PHP code to output:

<php
echo '<input value="' . $_SESSION['logged_user']->login . '">';
?>

Upvotes: 1

Related Questions