Re: help putting zero in front of single digits in select



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/
.