For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > April 2005 > Entering the date as default within a form









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Entering the date as default within a form
cover

2005-04-14, 3:56 am

Anyone know how to enter the time into a form or a website that might
tell how? I'm using the following html code and trying to get the
time to default into the text box. thanks

html code
<tr>
<td><b>Date:</b></td>
<td align="left"><input type="text" name="date" size="8"
maxlength="8"></td>
</tr>

php code
<? print strftime("%m/%d/%Y"); ?>
Kimmo Laine

2005-04-14, 3:56 am

"cover" <coverland914 @ yahoo.com> wrote in message
news:1113454894. 4bb141615120e1296a93de388b824915@teranew
s...
> Anyone know how to enter the time into a form or a website that might
> tell how? I'm using the following html code and trying to get the
> time to default into the text box. thanks
>
> html code
> <tr>
> <td><b>Date:</b></td>
> <td align="left"><input type="text" name="date" size="8"
> maxlength="8"></td>
> </tr>
>
> php code
> <? print strftime("%m/%d/%Y"); ?>


<input type="text" name="date" size="8" maxlength="8"
value="<? print strftime("%m/%d/%Y"); ?>">



--
Welcome to Usenet! Please leave tolerance, understanding
and intelligence at the door. They aren't welcome here.
eternal piste erection miuku gmail piste com


cover

2005-04-14, 3:55 pm

On Thu, 14 Apr 2005 08:51:44 +0300, "Kimmo Laine"
<eternal.erectionN05P@Mgmail.com> wrote:

>"cover" <coverland914 @ yahoo.com> wrote in message
>news:1113454894. 4bb141615120e1296a93de388b824915@teranew
s...
>
><input type="text" name="date" size="8" maxlength="8"
>value="<? print strftime("%m/%d/%Y"); ?>">



Tried replacing with your suggested code and the <? print strftrime(
shows up in the form frame window with "> on the outside of the frame
(just to the right). Thank you for the reply. Did that little
snippet of code work on your end with your suggestion?

Oli Filth

2005-04-14, 3:55 pm

cover wrote:
> On Thu, 14 Apr 2005 08:51:44 +0300, "Kimmo Laine"
> <eternal.erectionN05P@Mgmail.com> wrote:
>
>
>
>
>
> Tried replacing with your suggested code and the <? print strftrime(
> shows up in the form frame window with "> on the outside of the frame
> (just to the right). Thank you for the reply. Did that little
> snippet of code work on your end with your suggestion?
>


Try <?php instead of <?. <? only works if short_open_tag is enabled, and
sounds as if it isn't on your set-up.

--
Oli
Kimmo Laine

2005-04-14, 3:55 pm

"cover" <coverland914 @ yahoo.com> kirjoitti
viestissä:1113486217. 4f48b735f5fb347837b4f6a225e796bd@teranew
s...
> On Thu, 14 Apr 2005 08:51:44 +0300, "Kimmo Laine"
> <eternal.erectionN05P@Mgmail.com> wrote:
>
>
>
> Tried replacing with your suggested code and the <? print strftrime(
> shows up in the form frame window with "> on the outside of the frame
> (just to the right). Thank you for the reply. Did that little
> snippet of code work on your end with your suggestion?
>


That just means that PHP was not executed. I didn't test it, but I've done
it million gazillion times to know it works if everything else is okay. I'm
curious though, in your previous example: was the date output correctly when
the php code was outside the input field? I mean if it was: I don't know
what the hell broke it now. It should've been printed below the input field.
Just do what Oli suggested and replace <? ?> with <?php ?>. And tell us if
you usually get any kind of php output.


cover

2005-04-15, 3:56 am

On Thu, 14 Apr 2005 08:51:44 +0300, "Kimmo Laine"
<eternal.erectionN05P@Mgmail.com> wrote:

>"cover" <coverland914 @ yahoo.com> wrote in message
>news:1113454894. 4bb141615120e1296a93de388b824915@teranew
s...
>
><input type="text" name="date" size="8" maxlength="8"
>value="<? print strftime("%m/%d/%Y"); ?>">



SUCCESS !!!

Thank you everyone who replied. Appreciate your help and time very
much... :-)
Oli Filth

2005-04-16, 3:56 pm

cover wrote:
> On Thu, 14 Apr 2005 08:51:44 +0300, "Kimmo Laine"
> <eternal.erectionN05P@Mgmail.com> wrote:
>
>
>
>
>
> Tried replacing with your suggested code and the <? print strftrime(
> shows up in the form frame window with "> on the outside of the frame
> (just to the right). Thank you for the reply. Did that little
> snippet of code work on your end with your suggestion?
>


Try <?php instead of <?. <? only works if short_open_tag is enabled, and
sounds as if it isn't on your set-up.

--
Oli
Kimmo Laine

2005-04-16, 3:56 pm

"cover" <coverland914 @ yahoo.com> kirjoitti
viestissä:1113486217. 4f48b735f5fb347837b4f6a225e796bd@teranew
s...
> On Thu, 14 Apr 2005 08:51:44 +0300, "Kimmo Laine"
> <eternal.erectionN05P@Mgmail.com> wrote:
>
>
>
> Tried replacing with your suggested code and the <? print strftrime(
> shows up in the form frame window with "> on the outside of the frame
> (just to the right). Thank you for the reply. Did that little
> snippet of code work on your end with your suggestion?
>


That just means that PHP was not executed. I didn't test it, but I've done
it million gazillion times to know it works if everything else is okay. I'm
curious though, in your previous example: was the date output correctly when
the php code was outside the input field? I mean if it was: I don't know
what the hell broke it now. It should've been printed below the input field.
Just do what Oli suggested and replace <? ?> with <?php ?>. And tell us if
you usually get any kind of php output.


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com