Probleme when I set a value to an input

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
schneiderj
Forum Newbie
Posts: 11
Joined: Tue Mar 15, 2005 4:36 am

Probleme when I set a value to an input

Post by schneiderj »

Hello !

I have a probleme with the the following code :

Code: Select all

<html><body>
<?php
 	$Nom = "Louis Marie";
?>
<input name="nom" type="text" size="80" value=<?php echo $Nom; ?>>
</body></html>

when I point my browser to this page I have only the truncated name in the input field (only Louis)...

Where is the error ?
Thanks for your help,
Jean-Marie
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

i dont see any error, but maybe im blind. your problem is that it only displays Louis in the text field not Louis Marie??

try echoing $Nom out right after you set it and see what happens.

maybe do

Code: Select all

<input name="nom" type="text" size="80" value="<? echo $Nom; ?>">
just a guess.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Shiz is correct. Having whitespace in an attribute value with no quotes is a no go. The second word reads like it should be an attribute in itself ;-)
schneiderj
Forum Newbie
Posts: 11
Joined: Tue Mar 15, 2005 4:36 am

Post by schneiderj »

Thank you for your reply.

I try your solution and that did not till work :? . I have a look at the code in the browser and I have this :

Code: Select all

<input name=&quote;nom&quote; size=&quote;80&quote; value=&quote;Louis&quote; Marie=&quote;&quote; type=&quote;text&quote;>
Marie is a new parameter of input :evil: . What can I do ?
schneiderj
Forum Newbie
Posts: 11
Joined: Tue Mar 15, 2005 4:36 am

Post by schneiderj »

Sorry that solution work... :oops:
Thank you for your help :D .

Jean-Marie
Post Reply