You are here: Re: Getting values into a form: PHP (Server) or Javascript (Client) Side? « All PHP « IT news, forums, messages
Re: Getting values into a form: PHP (Server) or Javascript (Client) Side?

Posted by J.O. Aho on 09/28/53 11:41

Good Man wrote:
> "J.O. Aho" <user@example.net> wrote in
> news:46r7pkFchn19U1@individual.net:
>
>
>> I don't really see the point in using javascript at all in this case,
>> you get a more difficulty to figure out bugs.
>>
>> if you use
>>
>> <input type="text" id="firstName" value="<?= $first_name ?>" />
>> <input type="text" id="secondtName" value="<?= $second_name ?>" />
>> <input type="text" id="lastName" value="<?= $last_name ?>" />
>>
>> You either have a value set of the variables $first_name,
>> $second_name, $last_name and so on (I know, I added the two last
>> ones).
>>
>> If a value isn't set, then the box will be empty and it's just to add
>> the values manually.
>
> The only point would be saving me programming time. On a page with 50+
> form-fields, I can save lot of time by writing a PHP loop that writes an
> HTML call to a javscript function instead of going to each form field and
> entering the value="<?= $first_name ?>" stuff...

You have to add the input tag, so adding a little bit extra code don't make a
difference. You could even make a loop that does generate all the input tags
(makes your page even more dynamical), all you would need is id's in a array
(if you use the same name for the variables and the id's).


//Aho

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация