You are here: Re: help putting zero in front of single digits in select « PHP Programming Language « IT news, forums, messages
Re: help putting zero in front of single digits in select

Posted by Alan Little on 05/18/06 18:17

Carved in mystic runes upon the very living rock, the last words of
Patrick of comp.lang.php make plain:

> Kind of new to PHP. I have an html form where a person inputs a date
> via a drop down select. How do I make php put a zero in front of the
> numbers 1-9 ie. 01 02 03 when writing to the file? I have tried making
> the value="01" etc. but this doesn't work.

Unless you're doing something in your code to explicitly change the type
of $logday to numerical, there's no reason that zero-padding in the
VALUE attribute shouldn't work.

<?php
$x = '01';
echo $x;
?>

Outputs 01

<?php
$x = '01';
$x*= 1;
echo $x;
?>

Outputs 1

--
Alan Little
Phorm PHP Form Processor
http://www.phorm.com/

 

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

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