Results 1 to 7 of 7

Thread: Date field in HTML form

  1. #1
    Join Date
    Mar 2010
    Posts
    338

    Date field in HTML form

    Hello,
    I ask a small question. I am sending a form to order. I have two files: test1.php and test2.php. Everything works fine. I would like only the form, there is a field or the user can choose the date of delivery of the product and of course he can not choose a date before the current date. How can I do this? Any help will be appreciated. Thank you.

  2. #2
    Join Date
    Jan 2010
    Posts
    126

    Re: Date field in HTML form

    I propose to fill forms to my clients, who will then feed a mysql database, but how to have the date of registration include it?
    Is there a miracle function like:
    Code:
    <Input type = "hidden" name = "date" value = "date???"
    I could insert into my form? Thank you all for your help.

  3. #3
    Join Date
    Nov 2009
    Posts
    343

    Re: Date field in HTML form

    Why do not you put the date in. via PHP ? because you'd have javascript turned off. So you do something like
    Code:
    <Input type = "hidden" name = "date" value = "<? Today's date in PHP?>"

  4. #4
    Join Date
    Nov 2009
    Posts
    518

    Re: Date field in HTML form

    I injected the code:
    <Input type = "hidden" name = "date" value = "<? Php echo date (" cmd");?>">
    and everything is OK. In one form, I create a list box to the customer inserts his city. Here's the code:
    Code:
     <select name="vl" id="vl"> 
                  <option> Choose ...</ option> 
                  <option value="vl1"> town1 </ option> 
                  <option value="vl2"> vl2 </ option> 
                  <option value="vl3"> vl3 </ option> (etc. ..) 
              </ Select>
    But if the city of the customer is not in this list, I asked him to return the input directly by the function:
    Code:
              <input type="text" name="vl" id="vl">
    If the user enters the names of his city by the function input is OK, but if he selects a city from the dropdown list, it is automatically deleted by the function input that follows, and in which n has not returned. What to do? In any case thank you 1000 times for once the date (it's true that I had to post it in php, both for me).

  5. #5
    Join Date
    Mar 2010
    Posts
    162

    Re: Date field in HTML form

    You put two fields cities:
    Code:
    you select your call tw1 
    and your input vl2
    PHP and you tested:
    Code:
    if tw1 = name
    then vlchoice = vl2 
    otherwise vlchoice = tw1
    It's not hard to make a php IF statement.

  6. #6
    Join Date
    Dec 2009
    Posts
    202

    Re: Date field in HTML form

    This is the code you are looking for
    Code:
    <form action="" method="post"> 
      <p> 
        Choose your city: 
          <select name="chx1" id="chx1"> 
          <option value=""> Select </ option> 
          <option value="vl1"> town1 </ option> 
          <option value="vl2"> vl2 </ option> 
          <option value="vl3"> vl3 </ option> 
        </ Select> 
    </ P> 
      <p> or enter the name of your city: 
        <input type="text" name="chx2" id="chx2"> 
    </ P> 
      <p> 
        <input type="submit" name="submit" value="Envoyer"> 
    </ P> 
      </ p> 
      </ p> 
      <Php 
     $ d = $ _POST ['chx1']; 
     $ d2 = $ _POST ['chx2']; 
     if ($ d == "") 
     ( 
     ?> 
     <Input type = "hidden" name = "city" value = "<? Echo $ d2;?>"> 
     <? 
     echo $ d1; 
     echo $ d2; 
     
     ) 
     ?> 
    </ Form>

  7. #7
    Join Date
    Sep 2009
    Posts
    152

    Re: Date field in HTML form

    The problem is that I must submiter TWICE before having the correct value (the correct name of town) in the variable $ Resu-that's a bit messy ... It should be something that "pre-valid" variables and choix1 choix2; I Potash my big books, and I found the "OnBlur" but I know the syntax ... What do you think?

Similar Threads

  1. Replies: 5
    Last Post: 25-05-2011, 10:21 PM
  2. How to make Opera remember form field entries
    By Ansari Bros in forum Technology & Internet
    Replies: 3
    Last Post: 02-01-2011, 07:29 PM
  3. Switch the 'action' field in an HTML form
    By MarceloQuad in forum Software Development
    Replies: 4
    Last Post: 07-02-2010, 06:05 AM
  4. Disable yellow autocomplete form field
    By teenQ in forum Technology & Internet
    Replies: 3
    Last Post: 06-08-2009, 09:57 PM
  5. To access a text field from another form
    By Sanket07 in forum Software Development
    Replies: 6
    Last Post: 06-02-2009, 06:42 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,646,797.90788 seconds with 17 queries