user3586157
user3586157

Reputation: 1

how can I echo php variables to HTML forms?

I have a php script which gets data from a DB (it works) but need to write the retrieved values to textboxes in an HTML form (pure html form, no php). How do I reference the html file and its text boxes from my PHP script?

Upvotes: 0

Views: 1039

Answers (1)

Jnt0r
Jnt0r

Reputation: 173

PHP is exactly for that purpose. You can not make a webpage dynamically with just HTML. You would achieve what you want when "print" a PHP Variable in an HTML input field.

So you create a .php file and write down your HTML. And when you want your variable in your fields you do this:

<input value="<?= $yourVariableName; ?>">

That's the ways how you can print PHP variables into HTML.

Upvotes: 1

Related Questions