Results 1 to 4 of 4

Thread: calendar usage in html forms and getting the values in php

  1. #1
    Join Date
    Jun 2015
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy calendar usage in html forms and getting the values in php

    hi,

    I used the calendars in a html form which displays the month and year. So the user can select the month and year.
    And I have a php coding which saves the details in the html form to mysql database. If I 'm using the "dynamic calendars"
    in this website... which allows me to paste some coding into the 'body' section of my page and the 'body' tag and download a
    "calendar.js" script in the same directory
    of which I'm using. How will I get the values using the POST or GET method in php?

    or is there anyother better way to use calendars and recieve the values in a variable in php. Can someone help me out?
    Thanks in advance.

  2. #2
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    Its impossible for anyone to help without a link to the source calendar script, and your web page.

    - If you are using a script from another website, please provide the link to the website page where the calendar can be seen in action.
    - If you are using a script from Dynamic Drive, please follow the correct posting format as detailed in this post http://www.dynamicdrive.com/forums/showthread.php?t=6

    You should also provide a link to your website where the calendar script is installed ON YOUR WEBSITE so that we can see the problem and/or what you're working with.
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  3. #3
    Join Date
    Jun 2015
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks for the format...

    I 'm just a beginner with PHP and mySQL. Presently practicing with XAMPP v5.6.8(PHP v5.6.8). I use drop down lists to select the month and year in a html form like the the coding below:

    In "XXXX.php"
    Code:
    <html>
    <head><title>Sales Commission </title>
    </head>
    <body>
    ...
    <p>Month :
    <input type="month" name="Month">
    <select name = "Month">
    <option value="January">January</option>
    <option value="February">February</option>
    <option value="March">March</option>
    <option value="April">April</option>
    <option value="May">May</option>
    </select>
    similarly a dropdown list for the "year" with a
    Code:
    <form action='<?php $_SERVER['PHP_SELF'] ?>' method="POST">
    <input type="submit" name="submit" value="Submit">
    and then the php code in the same page
    PHP Code:
    <?php

        
    // Connect to database server
        
    mysql_connect("localhost""username"" ") or die (mysql_error ());

        
    // Select database
        
    mysql_select_db("mydatabase") or die(mysql_error());

           
    // receive the variables using the POST method
           
    $a=$_POST['Month'];
           
    $b=$_POST['year'];

        
    // The SQL statement is built

        
    $strSQL "INSERT INTO salesdata(Month, year) VALUES ('$a', '$b')";

        
    ";

        // The SQL statement is executed 
        mysql_query(
    $strSQL) or die (mysql_error());

        // Close the database connection
        mysql_close();
        ?>
    But if I use the calendar script from a website
    Script name : Dynamic Calendar
    http://www.dynamicdrive.com/dynamicindex6/dcalendar.htm

    when user selects a month or year in the form, how to receive data in php and insert it into the database

    How to store it in a mysql database in XAMPP? or in anyother database... Any suggestions on how to learn advanced stuffs in PHP.. books? websites?

    Hope I'm clear...
    Thanks
    Last edited by Beverleyh; 06-26-2015 at 08:24 AM. Reason: formatting

  4. #4
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    I dont think that script is suitable for your needs. Try looking for something else using keywords "date picker" or "calendar to form input field". Or start here http://www.bitrepository.com/a-colle...e-pickers.html

    Of the options on DD, this looks most suitable: http://www.dynamicdrive.com/dynamici...oncalendar.htm

    Once JavaScript inserts the date into your form's date field, is should be processed automatically by your php script.

    Look for options within the date picker config (of whichever script you choose) that allow you to specify date format so that the date is in the right format for the php to process as soon as it goes in to the input field.

    If you need more help, post back with your script selection AND A LINK TO THE PAGE ON YOUR WEBSITE!
    Last edited by Beverleyh; 06-26-2015 at 08:30 AM. Reason: link to DD script added
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

Similar Threads

  1. Java script in HTML forms
    By gemzilla in forum JavaScript
    Replies: 1
    Last Post: 06-21-2012, 11:34 AM
  2. Dynamically call up Chart values in HTML
    By louisaa in forum JavaScript
    Replies: 1
    Last Post: 08-30-2011, 09:43 PM
  3. HTML editor for forms
    By Rohan72 in forum Looking for such a script or service
    Replies: 1
    Last Post: 06-03-2007, 09:56 AM
  4. Passing values between html pages
    By y1k2h3 in forum HTML
    Replies: 6
    Last Post: 11-30-2006, 08:04 AM
  5. Popup window and html forms
    By robburne in forum JavaScript
    Replies: 0
    Last Post: 03-14-2006, 11:19 PM

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
  •