SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Enthusiast barrykins's Avatar
    Join Date
    Feb 2011
    Location
    Virginia Beach, Virginia
    Posts
    47
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Editable Forms + Mulitiple Forms

    I was asked to see if I could build a form for a child care website that takes care of the children during events.

    I thought the form would be easy at first but I was asked if I can build the forms and a database to store forms for each event.
    Also the client wants to be able to edit the forms for each event.

    Just wondering where I should start on this.
    The making of the form? Or the behind the scenes?
    (Also, the client does not use a CMS for the rest of the built site but needs this to just be an add-on.)

    Any type of pointers would be great since I'm fairly new to PHP.

  2. #2
    SitePoint Member
    Join Date
    Nov 2011
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Your best bet is to use Javascript to build the forms. Once they are built, you can use an AJAX call (or just a form POST) to save the form to the database. You could serialize all the data, or you could process it and split it into tables nicely - whatever you want to do.

    Then just do the reverse to display it again.

    There should be some decent plugins for jQuery to pretty much do this all for you.

  3. #3
    SitePoint Enthusiast barrykins's Avatar
    Join Date
    Feb 2011
    Location
    Virginia Beach, Virginia
    Posts
    47
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Why do you suggest using Javascript to build the forms?

  4. #4
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Also the client wants to be able to edit the forms for each event.
    Can you give a concrete example of what you mean by that?

    JS alone cannot store information, you need a server-side lang (like PHP) to do that for you unless you

    a) run JS on the server, or
    b) want to rely upon HTML5's server side persistence

  5. #5
    SitePoint Enthusiast barrykins's Avatar
    Join Date
    Feb 2011
    Location
    Virginia Beach, Virginia
    Posts
    47
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Cups View Post
    Can you give a concrete example of what you mean by that?

    JS alone cannot store information, you need a server-side lang (like PHP) to do that for you unless you

    a) run JS on the server, or
    b) want to rely upon HTML5's server side persistence
    Yeah thats what I thought was the case. I don't want to meddle into HTML5 yet either so the site can be accessible to as many people as possible.

    About the forms, the client is a child care business and they are expanding the group events for child care.
    Therefore, on their website the parents will have the option to register their child for an event that has already been set up by the child care business.

    So the child care business needs to be able to input data into a already set form. (Event Name, Event Code, Date, Time, Child name, etc..)
    Then when the parent goes to register their child, they first put Event Code and this finds the right event for them. After that they have the option to pick what time, if there are two times like a weddings ceremony and reception then they get to the main form where they put Mothers Name, Fathers Name, Both of their cellphones#, childs name, Childs DOB, Allegeries, Etc... They can also have the option to upload the photo.

    The child care business will then have the option to go to a page and bring up the form for each child, for each event.

    I know this should all be built with PHP, and I'm fairly fine with HTML and standards so thats no issues. It doesn't sound too complex but the transfer of information from the input to the database is my main issue. I'm sure calling the stored arrays into a page shouldn't be an issue.

    I can upload a graphic representation of the information soon if its needed.

  6. #6
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    You will be able to do all of this using PHP.

    Start with a simple html form and learn how to put the output of that form into a database.

    Learn about Filtering data against expectations, and about Escaping data to protect your database from attack.

    Slowly add form elements.

    Learning about and aligning times and dates between PHP and Mysql is usually the most complex thing to work out.

    When you have successfully accomplished that, then add JS validation on the client to make your app seem more responsive.

    The design of your database tables will probably be your biggest headache.

    At each stage, post any questions you have - with small code samples on this forum, or search this forum for answers.

    First move is probably to google for PHP / Mysql form tutorials - an acronym to become familiar with is CRUD (create, read, update and delete)

  7. #7
    SitePoint Enthusiast barrykins's Avatar
    Join Date
    Feb 2011
    Location
    Virginia Beach, Virginia
    Posts
    47
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Cups View Post
    You will be able to do all of this using PHP.

    Start with a simple html form and learn how to put the output of that form into a database.

    Learn about Filtering data against expectations, and about Escaping data to protect your database from attack.

    Slowly add form elements.

    Learning about and aligning times and dates between PHP and Mysql is usually the most complex thing to work out.

    When you have successfully accomplished that, then add JS validation on the client to make your app seem more responsive.

    The design of your database tables will probably be your biggest headache.

    At each stage, post any questions you have - with small code samples on this forum, or search this forum for answers.

    First move is probably to google for PHP / Mysql form tutorials - an acronym to become familiar with is CRUD (create, read, update and delete)
    Thanks for the help! I'm more at ease to know that it's achievable though. I bought the Sitepoint PHP and Mysql book, so I'm hoping that will help.

  8. #8
    SitePoint Member
    Join Date
    Nov 2011
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by barrykins View Post
    Why do you suggest using Javascript to build the forms?
    Because otherwise it's not really possible, or at least way more complicated than it needs to be - plus it would be very annoying for the user. You'd have to reload the page every time something was changed.

  9. #9
    SitePoint Enthusiast barrykins's Avatar
    Join Date
    Feb 2011
    Location
    Virginia Beach, Virginia
    Posts
    47
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by scootstah View Post
    Because otherwise it's not really possible, or at least way more complicated than it needs to be - plus it would be very annoying for the user. You'd have to reload the page every time something was changed.
    For what I'm building, I don't need to have AJAX since content is not streaming dynamically to the page second by second. HTML and PHP seems fine with jQuery to make it user friendly.


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
  •