SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2000
    Location
    Grand Rapids, MI
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry to cram all this in one message, but it's all on my mind, any help is greatly appreciated.

    First, can PHP output its processing to a text file, such as building an HTML file, but saving it, instead of just working it on the fly? Or would CGI be better for that?

    Second, I have an html form, that is accepting input from the user to pass along and insert into a table, my problem/question involves accepting input from the user in the proper format. Take this table layout for instance:

    ---------- tbltest ----------

    first_name VARCHAR(30)
    last_name VARCHAR(30)
    birthdate DATE
    description BLOB

    ---------- end -----------

    In my submitform.html, I have :

    <html><body>
    <form action=submitform.php3 method=get>

    First Name : <input type=text name=first_name size=30 maxlength=30>

    Last Name : <input type=text name=last_name size=30 maxlength=30>

    #### Down to this point works with no problems ####

    Birth Date : <input type=date name=birthdate>

    #### For birthdate, is there anyway to tell the form to accept only a certain format, or would it just be easier to request a YYYY in one box, MM in another, and DD in the last and put them together in the order I want before sending them to mysql? ####

    Description :

    #### In the description area is where I really have my main question, what is the proper "type" that I can use to provide a bigger text box (much like the one I'm typing in now for this message, with scrollbar) ? I did have type=text maxlength=255, but that doesn't work too well, as some of my descriptions are larger than 255 chars. ####

    Thanks again,

    Mike



    ------------------

  2. #2
    SitePoint Zealot
    Join Date
    Nov 1999
    Location
    Manhattan!
    Posts
    107
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, lets see:

    1) You, php can work on files (I do that all the time). It looks a lot like C, with commands such as

    $fp = fopen("myfile","w");
    fputs($fp,"<HTML><HEAD>...");
    fclose($fp);

    2) I can remember the exact command right now, but php has several commands to either check if it is a valid date and to convert it between formats. If nothing else will work for you, just set up a little case statement, that checks what format the date was entered in and then converts it.

    3) Why not just use a type TEXT? That can be of arbitrary length...

    Christian



    ------------------
    Axie automatically performs free, customizable searches for new
    websites and delivers the links to members by personalized email.
    http://www.axie.com/

  3. #3
    SitePoint Enthusiast
    Join Date
    Feb 2000
    Location
    Grand Rapids, MI
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Will using type=text just put a text box up there (with multiple lines)? I see in the source of this 'reply to topic' page that they use TEXTAREA, I think I'll give that a try.

    Thanks for the answers 1 & 2, I'll work on those as well.

    Mike



    ------------------
    My new position : Target for Middle Management Hostility.

  4. #4
    SitePoint Zealot
    Join Date
    Nov 1999
    Location
    Manhattan!
    Posts
    107
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The type=text refered to the mySQL table entry that would hold the info...

    Christian


    ------------------
    Axie automatically performs free, customizable searches for new
    websites and delivers the links to members by personalized email.
    http://www.axie.com/

  5. #5
    SitePoint Member
    Join Date
    Jul 1999
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have the same thing on my site where a date is needed in a form. The best thing to do is make the form fields drop down boxes. Therefore the visitor has make a choice of day (1-31), month (Jan-Dec)and even year if you like. This would then be submitted in a format that you have control over.

    If you need the html for this, just leave a message here.

    Ben

  6. #6
    SitePoint Enthusiast
    Join Date
    Feb 2000
    Location
    Grand Rapids, MI
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think the dropdown box is going to do the trick for the date. Appreciate the help everyone.

    Mike


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
  •