how to set value to inputs of a form

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
php12342005
Forum Commoner
Posts: 79
Joined: Mon Mar 21, 2005 3:35 am

how to set value to inputs of a form

Post by php12342005 »

I have a form with 2 inputs (type=text), i.e. id and name.

when I click button Read, php reads info from database about id and name.
my question is:
how to set values (id and name) to these 2 inputs from php code?

thanks
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

Code: Select all

if (!isset($id)) $id = 'default';

echo "<input type='text' name='id' value='$id'/>";
php12342005
Forum Commoner
Posts: 79
Joined: Mon Mar 21, 2005 3:35 am

Post by php12342005 »

timvw,
it works, thanks.

one question:
is single speach mark ' the same as double speach mark " in php?

I can not find answer in google.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

Post Reply